From 99a1b7274cd884c301b0bb3c96ba6ee226b36727 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Sat, 17 May 2014 00:22:56 +1000 Subject: [PATCH] Transaction: use the type embedded in the signature --- src/transaction.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/transaction.js b/src/transaction.js index 2b50940..bfbbe0e 100644 --- a/src/transaction.js +++ b/src/transaction.js @@ -380,10 +380,11 @@ Transaction.prototype.setScriptSig = function(index, script) { this.ins[index].script = script } -Transaction.prototype.validateSig = function(index, script, pub, sig, type) { - type = type || SIGHASH_ALL +Transaction.prototype.validateSig = function(index, script, pub, sig) { + var type = sig[sig.length - 1] var hash = this.hashForSignature(script, index, type) + sig = sig.slice(0, -1) return pub.verify(hash, sig) }