Skip to content

Commit 10a3a04

Browse files
Merge pull request bisq-network#7294 from alvasw/sendBsq_Throw_InsufficientMoneyException_when_BSQ_balance_too_low
sendBsq: Throw InsufficientMoneyException when BSQ balance too low
2 parents 7a6ef6b + a7ff534 commit 10a3a04

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/main/java/bisq/core/btc/wallet/BsqWalletV2.java

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public TransactionBroadcast sendBsq(Address receiverAddress,
4747
bsqTx.addOutput(receiverAmount, receiverAddress);
4848

4949
CoinSelection selection = bsqCoinSelector.select(receiverAmount, bsqWallet.calculateAllSpendCandidates());
50+
if (selection.valueGathered.isLessThan(receiverAmount)) {
51+
throw new InsufficientMoneyException(receiverAmount, "Wallet doesn't have " + receiverAmount + " BSQ.");
52+
}
5053
selection.gathered.forEach(bsqTx::addInput);
5154

5255
Coin change = bsqCoinSelector.getChange(receiverAmount, selection);

0 commit comments

Comments
 (0)