Skip to content

Commit

Permalink
sort with bigger outputs first when choosing utxo.
Browse files Browse the repository at this point in the history
  • Loading branch information
caedesvvv committed Oct 26, 2014
1 parent 1257cc0 commit a259a73
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/model/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ Wallet.prototype.getUtxoToPay = function(value, pocketId, type) {
var high = utxo.filter(function(o) { return valueMatch(o.value, value); })
.sort(valuecompare);
if (high.length > 0) { return [high[0]]; }
utxo.sort(valuecompare);
// here sort bigger first
utxo.sort(function(a, b) { return a.value < b.value; });
var totalval = 0;
for (var i = 0; i < utxo.length; i++) {
totalval += utxo[i].value;
Expand Down

0 comments on commit a259a73

Please sign in to comment.