Merge pull request #524 from isocolsky/fix/get-utxo-bug
Fix 0 UTXOs & locked inputs
This commit is contained in:
commit
bceab68f18
|
@ -922,7 +922,8 @@ WalletService.prototype._getUtxosForCurrentWallet = function(addresses, cb) {
|
|||
var addressStrs = _.pluck(allAddresses, 'address');
|
||||
self._getUtxos(addressStrs, function(err, utxos) {
|
||||
if (err) return next(err);
|
||||
if (utxos.length == 0) return next(null, []);
|
||||
|
||||
if (utxos.length == 0) return cb(null, []);
|
||||
allUtxos = utxos;
|
||||
utxoIndex = _.indexBy(allUtxos, utxoKey);
|
||||
return next();
|
||||
|
|
|
@ -1416,6 +1416,28 @@ describe('Wallet service', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
it('should not fail when getting UTXOs for wallet with 0 UTXOs and pending txps', function(done) {
|
||||
helpers.stubUtxos(server, wallet, [1, 1], function() {
|
||||
var txOpts = {
|
||||
outputs: [{
|
||||
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7',
|
||||
amount: 1e8,
|
||||
}],
|
||||
feePerKb: 100e2,
|
||||
};
|
||||
helpers.createAndPublishTx(server, txOpts, TestData.copayers[0].privKey_1H_0, function(txp) {
|
||||
blockchainExplorer.getUtxos = function(addresses, cb) {
|
||||
return cb(null, []);
|
||||
};
|
||||
|
||||
server.getUtxos({}, function(err, utxos) {
|
||||
should.not.exist(err);
|
||||
utxos.should.be.empty;
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Multiple request Pub Keys', function() {
|
||||
|
|
Loading…
Reference in New Issue