add (some) fromAddress and getInType tests to script

This commit is contained in:
Wei Lu 2014-03-22 21:01:40 +08:00
parent c3880c0cdf
commit 83381186d1
2 changed files with 34 additions and 6 deletions

View file

@ -150,6 +150,7 @@ Script.prototype.toScriptHash = function() {
return util.sha256ripe160(this.buffer)
}
//TODO: support testnet
Script.prototype.getToAddress = function() {
var outType = this.getOutType();
@ -164,6 +165,11 @@ Script.prototype.getToAddress = function() {
return new Address(this.chunks[1], 5)
}
//TODO: support testnet
Script.prototype.getFromAddress = function(){
return new Address(this.simpleInHash());
}
/**
* Compare the script to known templates of scriptSig.
*