Browse Source

Merge pull request #422 from isocolsky/fix/multiple-output-amount

Fix initialization of amount field in multiple_output proposals
activeAddress
Matias Alejo Garcia 9 years ago
parent
commit
4b5bb8d53a
  1. 1
      lib/model/txproposal_legacy.js
  2. 5
      test/integration/server.js

1
lib/model/txproposal_legacy.js

@ -45,6 +45,7 @@ TxProposal._create.multiple_outputs = function(txp, opts) {
return _.pick(output, ['amount', 'toAddress', 'message']); return _.pick(output, ['amount', 'toAddress', 'message']);
}); });
txp.outputOrder = _.shuffle(_.range(txp.outputs.length + 1)); txp.outputOrder = _.shuffle(_.range(txp.outputs.length + 1));
txp.amount = txp.getTotalAmount();
try { try {
txp.network = Bitcore.Address(txp.outputs[0].toAddress).toObject().network; txp.network = Bitcore.Address(txp.outputs[0].toAddress).toObject().network;
} catch (ex) {} } catch (ex) {}

5
test/integration/server.js

@ -2467,6 +2467,7 @@ describe('Wallet service', function() {
server.createTxLegacy(txOpts, function(err, tx) { server.createTxLegacy(txOpts, function(err, tx) {
should.not.exist(err); should.not.exist(err);
should.exist(tx); should.exist(tx);
tx.amount.should.equal(helpers.toSatoshi(150));
done(); done();
}); });
}); });
@ -4790,7 +4791,9 @@ describe('Wallet service', function() {
}); });
}); });
it('should handle exceeded limit', function(done) { it('should handle exceeded limit', function(done) {
server.getTxHistory({limit:1000}, function(err, txs) { server.getTxHistory({
limit: 1000
}, function(err, txs) {
err.code.should.equal('HISTORY_LIMIT_EXCEEDED'); err.code.should.equal('HISTORY_LIMIT_EXCEEDED');
done(); done();
}); });

Loading…
Cancel
Save