diff --git a/lib/model/txproposal.js b/lib/model/txproposal.js index ee6896a..2937040 100644 --- a/lib/model/txproposal.js +++ b/lib/model/txproposal.js @@ -194,9 +194,12 @@ TxProposal.prototype._buildTx = function() { // Shuffle outputs for improved privacy if (t.outputs.length > 1) { - $.checkState(t.outputs.length == self.outputOrder.length); + var outputOrder = _.reject(self.outputOrder, function(order) { + return order >= t.outputs.length; + }); + $.checkState(t.outputs.length == outputOrder.length); t.sortOutputs(function(outputs) { - return _.map(self.outputOrder, function(i) { + return _.map(outputOrder, function(i) { return outputs[i]; }); }); diff --git a/test/integration/server.js b/test/integration/server.js index 702bb8f..4b95313 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -2146,7 +2146,7 @@ describe('Wallet service', function() { }); }); - it.only('should support creating a multiple output tx with no change address', function(done) { + it('should support creating a multiple output tx with no change address', function(done) { helpers.stubUtxos(server, wallet, [1, 2], function() { var max = 3 - (7560 / 1e8); // Fees for this tx at 100bits/kB = 7560 sat var outputs = [{