From d7ac63755f4f92f38d5207fadcbc24a7b95215fe Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 17 Aug 2016 23:45:00 -0700 Subject: [PATCH] wallet: sign refactor. --- lib/bcoin/wallet.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index d5aded79..4fae1249 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -1395,6 +1395,7 @@ Wallet.prototype.scriptInputs = function scriptInputs(tx, callback) { Wallet.prototype.sign = function sign(tx, options, callback) { var self = this; + var passphrase, timeout, index, type; if (typeof options === 'function') { callback = options; @@ -1404,15 +1405,20 @@ Wallet.prototype.sign = function sign(tx, options, callback) { if (typeof options === 'string' || Buffer.isBuffer(options)) options = { passphrase: options }; + passphrase = options.passphrase; + timeout = options.timeout; + index = options.index; + type = options.type; + this.deriveInputs(tx, function(err, rings) { if (err) return callback(err); - self.unlock(options.passphrase, options.timeout, function(err, master) { + self.unlock(passphrase, timeout, function(err, master) { if (err) return callback(err); - self._sign(rings, master, tx, options.index, options.type, callback); + self._sign(rings, master, tx, index, type, callback); }); }); };