Transaction: use the type embedded in the signature
This commit is contained in:
parent
6eb167b2c8
commit
99a1b7274c
1 changed files with 3 additions and 2 deletions
|
@ -380,10 +380,11 @@ Transaction.prototype.setScriptSig = function(index, script) {
|
||||||
this.ins[index].script = script
|
this.ins[index].script = script
|
||||||
}
|
}
|
||||||
|
|
||||||
Transaction.prototype.validateSig = function(index, script, pub, sig, type) {
|
Transaction.prototype.validateSig = function(index, script, pub, sig) {
|
||||||
type = type || SIGHASH_ALL
|
var type = sig[sig.length - 1]
|
||||||
var hash = this.hashForSignature(script, index, type)
|
var hash = this.hashForSignature(script, index, type)
|
||||||
|
|
||||||
|
sig = sig.slice(0, -1)
|
||||||
return pub.verify(hash, sig)
|
return pub.verify(hash, sig)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue