|
|
@ -1194,22 +1194,14 @@ Transaction.prototype.isValidSignature = function(signature) { |
|
|
|
/** |
|
|
|
* @returns {bool} whether the signature is valid for this transaction input |
|
|
|
*/ |
|
|
|
Transaction.prototype.verifySignature = function(sig, pubkey, nin, subscript, sigversion, satoshisBuffer) { |
|
|
|
Transaction.prototype.verifySignature = function(sig, pubkey, nin, subscript, sigversion) { |
|
|
|
|
|
|
|
if (_.isUndefined(sigversion)) { |
|
|
|
sigversion = 0; |
|
|
|
} |
|
|
|
|
|
|
|
if (_.isUndefined(satoshisBuffer)) { |
|
|
|
if (sigversion == 1) { |
|
|
|
throw new errors.Transaction.UnableToVerifySignature( |
|
|
|
'satoshisBuffer is required when sigversion is 1' |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (sigversion == 1) { |
|
|
|
return SighashWitness.verify(this, sig, pubkey, nin, subscript, satoshisBuffer); |
|
|
|
return SighashWitness.verify(this, sig, pubkey, nin, subscript, this.inputs[nin].getSatoshisBuffer()); |
|
|
|
} |
|
|
|
|
|
|
|
return Sighash.verify(this, sig, pubkey, nin, subscript); |
|
|
|