Skip to content

Commit

Permalink
Merge pull request #3327 from christophsturm/fix-dust-check
Browse files Browse the repository at this point in the history
Check for dust after subtracting fee, not before.
  • Loading branch information
freimair authored Nov 1, 2019
2 parents 8ee2d53 + b2befde commit d174535
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions core/src/main/java/bisq/core/btc/wallet/BtcWalletService.java
Original file line number Diff line number Diff line change
Expand Up @@ -1062,12 +1062,9 @@ private SendRequest getSendRequestForMultipleAddresses(Set<String> fromAddresses
@Nullable KeyParameter aesKey) throws
AddressFormatException, AddressEntryException, InsufficientMoneyException {
Transaction tx = new Transaction(params);
checkArgument(Restrictions.isAboveDust(amount),
"The amount is too low (dust limit).");

final Coin netValue = amount.subtract(fee);
if (netValue.isNegative())
throw new InsufficientMoneyException(netValue.multiply(-1), "The mining fee for that transaction exceed the available amount.");
checkArgument(Restrictions.isAboveDust(netValue),
"The amount is too low (dust limit).");

tx.addOutput(netValue, Address.fromBase58(params, toAddress));

Expand Down

0 comments on commit d174535

Please sign in to comment.