Browse Source

fix 0 UTXOs & locked inputs + test

activeAddress
Ivan Socolsky 9 years ago
parent
commit
d642931de2
No known key found for this signature in database GPG Key ID: FAECE6A05FAA4F56
  1. 3
      lib/server.js
  2. 22
      test/integration/server.js

3
lib/server.js

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

22
test/integration/server.js

@ -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…
Cancel
Save