From 8ade973b31f586797f9173d5cc5b6c4b67e31d92 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 13 Jan 2016 19:41:03 -0800 Subject: [PATCH] sighash work --- lib/bcoin/tx.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/bcoin/tx.js b/lib/bcoin/tx.js index 2a3b7907..43e3fb08 100644 --- a/lib/bcoin/tx.js +++ b/lib/bcoin/tx.js @@ -597,11 +597,12 @@ TX.prototype.signatureHash = function signatureHash(index, s, type) { type = constants.hashType[type]; assert(type != null); + assert(index < copy.inputs.length) // bitcoind used to return 1 as an error code: // it ended up being treated like a hash. - if (index >= copy.inputs.length) - return constants.oneHash.slice(); + // if (index >= copy.inputs.length) + // return constants.oneHash.slice(); copy.inputs.forEach(function(input, i) { input.script = i === index ? s : [];