From ac8905bf3db9c0a44a38f8da7ea11e9702fa2946 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 6 Jun 2014 14:54:02 -0500 Subject: [PATCH] fix: wallet.sign return value. --- lib/bcoin/wallet.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index 15cb69ce..87520a37 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -219,10 +219,10 @@ Wallet.prototype.sign = function sign(tx, type, inputs, off) { inputs = inputs || tx.inputs; // Add signature script to each input - inputs.forEach(function(input, i) { + inputs = inputs.filter(function(input, i) { // Filter inputs that this wallet own if (!input.out.tx || !this.ownOutput(input.out.tx)) - return; + return false; var s = input.out.tx.getSubscript(input.out.index); var hash = tx.subscriptHash(off + i, s, type); @@ -231,11 +231,13 @@ Wallet.prototype.sign = function sign(tx, type, inputs, off) { if (bcoin.script.isPubkeyhash(s)) { input.script = [ signature, pub ]; - return; + return true; } // Multisig input.script = [ [], signature ]; + + return true; }, this); return inputs.length;