improve path getting.

This commit is contained in:
Christopher Jeffrey 2016-05-31 06:45:32 -07:00
parent 2e5df5514a
commit 59755841f9
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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);
});
};