Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
fix(sweep): sweep for empty accounts must be zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
sha49 authored and Sjors committed Mar 8, 2016
1 parent 9937399 commit a6a78bc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ Payment.publish = function () {
////////////////////////////////////////////////////////////////////////////////
// computeSuggestedSweep :: [coins] -> [maxSpendeableAmount - fee, fee]
Payment.computeSuggestedSweep = function(coins, feePerKb) {
if (coins == null || coins.length === 0) { return [0,0]; }
feePerKb = Helpers.isNumber(feePerKb) ? feePerKb : MyWallet.wallet.fee_per_kb;
var getValue = function (coin) { return coin.value; };
var sortedCoinValues = coins.map(getValue).sort(function (a, b) { return b - a });
Expand Down

0 comments on commit a6a78bc

Please sign in to comment.