Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix send non bsq funds #4632

Merged
merged 1 commit into from Oct 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 9 additions & 5 deletions core/src/main/java/bisq/core/btc/wallet/BsqWalletService.java
Expand Up @@ -513,7 +513,7 @@ public void commitTx(Transaction tx, TxType txType) {

public Transaction getPreparedSendBsqTx(String receiverAddress, Coin receiverAmount)
throws AddressFormatException, InsufficientBsqException, WalletException, TransactionVerificationException, BsqChangeBelowDustException {
return getPreparedSendTx(receiverAddress, receiverAmount, bsqCoinSelector);
return getPreparedSendTx(receiverAddress, receiverAmount, bsqCoinSelector, false);
}

///////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -522,17 +522,21 @@ public Transaction getPreparedSendBsqTx(String receiverAddress, Coin receiverAmo

public Transaction getPreparedSendBtcTx(String receiverAddress, Coin receiverAmount)
throws AddressFormatException, InsufficientBsqException, WalletException, TransactionVerificationException, BsqChangeBelowDustException {
return getPreparedSendTx(receiverAddress, receiverAmount, nonBsqCoinSelector);
return getPreparedSendTx(receiverAddress, receiverAmount, nonBsqCoinSelector, true);
}

private Transaction getPreparedSendTx(String receiverAddress, Coin receiverAmount, CoinSelector coinSelector)
private Transaction getPreparedSendTx(String receiverAddress, Coin receiverAmount, CoinSelector coinSelector,
boolean allowSegwitOuput)
throws AddressFormatException, InsufficientBsqException, WalletException, TransactionVerificationException, BsqChangeBelowDustException {
daoKillSwitch.assertDaoIsNotDisabled();
Transaction tx = new Transaction(params);
checkArgument(Restrictions.isAboveDust(receiverAmount),
"The amount is too low (dust limit).");
tx.addOutput(receiverAmount, LegacyAddress.fromBase58(params, receiverAddress));

if (allowSegwitOuput) {
tx.addOutput(receiverAmount, Address.fromString(params, receiverAddress));
} else {
tx.addOutput(receiverAmount, LegacyAddress.fromBase58(params, receiverAddress));
}
SendRequest sendRequest = SendRequest.forTx(tx);
sendRequest.fee = Coin.ZERO;
sendRequest.feePerKb = Coin.ZERO;
Expand Down