From 59755841f92994b1b2b96983a751804087241ead Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 31 May 2016 06:45:32 -0700 Subject: [PATCH] improve path getting. --- lib/bcoin/wallet.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index 97b565be..39395ee2 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -705,11 +705,11 @@ Wallet.prototype.getInputPaths = function getInputPaths(tx, callback) { }); } - utils.forEachSerial(tx.inputs, function(input, next, i) { - if (!input.coin) - return next(new Error('Not all coins available.')); + if (!tx.hasCoins()) + return next(new Error('Not all coins available.')); - self.getPath(input.coin.getHash(), function(err, path) { + utils.forEachSerial(tx.getInputHashes(), function(hash, next, i) { + self.getPath(hash, function(err, path) { if (err) return next(err); @@ -723,7 +723,7 @@ Wallet.prototype.getInputPaths = function getInputPaths(tx, callback) { }, function(err) { if (err) return callback(err); - return callback(null, utils.uniq(paths)); + return callback(null, paths); }); }; @@ -747,8 +747,8 @@ Wallet.prototype.getOutputPaths = function getOutputPaths(tx, callback) { }); } - utils.forEachSerial(tx.outputs, function(output, next, i) { - self.getPath(output.getHash(), function(err, path) { + utils.forEachSerial(tx.getOutputHashes(), function(hash, next, i) { + self.getPath(hash, function(err, path) { if (err) return next(err); @@ -762,7 +762,7 @@ Wallet.prototype.getOutputPaths = function getOutputPaths(tx, callback) { }, function(err) { if (err) return callback(err); - return callback(null, utils.uniq(paths)); + return callback(null, paths); }); };