mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Use MemPoolSpaceTxBroadcaster for withdrawing
funds and for empty wallet call.
This commit is contained in:
parent
f26e76c908
commit
478e1224e8
2 changed files with 22 additions and 2 deletions
|
@ -24,6 +24,7 @@ import bisq.core.btc.exceptions.WalletException;
|
||||||
import bisq.core.btc.model.AddressEntry;
|
import bisq.core.btc.model.AddressEntry;
|
||||||
import bisq.core.btc.model.AddressEntryList;
|
import bisq.core.btc.model.AddressEntryList;
|
||||||
import bisq.core.btc.setup.WalletsSetup;
|
import bisq.core.btc.setup.WalletsSetup;
|
||||||
|
import bisq.core.btc.wallet.http.MemPoolSpaceTxBroadcaster;
|
||||||
import bisq.core.provider.fee.FeeService;
|
import bisq.core.provider.fee.FeeService;
|
||||||
import bisq.core.user.Preferences;
|
import bisq.core.user.Preferences;
|
||||||
|
|
||||||
|
@ -957,6 +958,10 @@ public class BtcWalletService extends WalletService {
|
||||||
try {
|
try {
|
||||||
sendResult = wallet.sendCoins(sendRequest);
|
sendResult = wallet.sendCoins(sendRequest);
|
||||||
printTx("FeeEstimationTransaction", newTransaction);
|
printTx("FeeEstimationTransaction", newTransaction);
|
||||||
|
|
||||||
|
// For better redundancy in case the broadcast via BitcoinJ fails we also
|
||||||
|
// publish the tx via mempool nodes.
|
||||||
|
MemPoolSpaceTxBroadcaster.broadcastTx(sendResult.tx);
|
||||||
} catch (InsufficientMoneyException e2) {
|
} catch (InsufficientMoneyException e2) {
|
||||||
errorMessageHandler.handleErrorMessage("We did not get the correct fee calculated. " + (e2.missing != null ? e2.missing.toFriendlyString() : ""));
|
errorMessageHandler.handleErrorMessage("We did not get the correct fee calculated. " + (e2.missing != null ? e2.missing.toFriendlyString() : ""));
|
||||||
}
|
}
|
||||||
|
@ -1139,7 +1144,11 @@ public class BtcWalletService extends WalletService {
|
||||||
if (memo != null) {
|
if (memo != null) {
|
||||||
sendResult.tx.setMemo(memo);
|
sendResult.tx.setMemo(memo);
|
||||||
}
|
}
|
||||||
printTx("sendFunds", sendResult.tx);
|
|
||||||
|
// For better redundancy in case the broadcast via BitcoinJ fails we also
|
||||||
|
// publish the tx via mempool nodes.
|
||||||
|
MemPoolSpaceTxBroadcaster.broadcastTx(sendResult.tx);
|
||||||
|
|
||||||
return sendResult.tx.getTxId().toString();
|
return sendResult.tx.getTxId().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1160,6 +1169,11 @@ public class BtcWalletService extends WalletService {
|
||||||
sendResult.tx.setMemo(memo);
|
sendResult.tx.setMemo(memo);
|
||||||
}
|
}
|
||||||
printTx("sendFunds", sendResult.tx);
|
printTx("sendFunds", sendResult.tx);
|
||||||
|
|
||||||
|
// For better redundancy in case the broadcast via BitcoinJ fails we also
|
||||||
|
// publish the tx via mempool nodes.
|
||||||
|
MemPoolSpaceTxBroadcaster.broadcastTx(sendResult.tx);
|
||||||
|
|
||||||
return sendResult.tx;
|
return sendResult.tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import bisq.core.btc.listeners.AddressConfidenceListener;
|
||||||
import bisq.core.btc.listeners.BalanceListener;
|
import bisq.core.btc.listeners.BalanceListener;
|
||||||
import bisq.core.btc.listeners.TxConfidenceListener;
|
import bisq.core.btc.listeners.TxConfidenceListener;
|
||||||
import bisq.core.btc.setup.WalletsSetup;
|
import bisq.core.btc.setup.WalletsSetup;
|
||||||
|
import bisq.core.btc.wallet.http.MemPoolSpaceTxBroadcaster;
|
||||||
import bisq.core.provider.fee.FeeService;
|
import bisq.core.provider.fee.FeeService;
|
||||||
import bisq.core.user.Preferences;
|
import bisq.core.user.Preferences;
|
||||||
|
|
||||||
|
@ -535,7 +536,12 @@ public abstract class WalletService {
|
||||||
sendRequest.aesKey = aesKey;
|
sendRequest.aesKey = aesKey;
|
||||||
Wallet.SendResult sendResult = wallet.sendCoins(sendRequest);
|
Wallet.SendResult sendResult = wallet.sendCoins(sendRequest);
|
||||||
printTx("empty btc wallet", sendResult.tx);
|
printTx("empty btc wallet", sendResult.tx);
|
||||||
Futures.addCallback(sendResult.broadcastComplete, new FutureCallback<Transaction>() {
|
|
||||||
|
// For better redundancy in case the broadcast via BitcoinJ fails we also
|
||||||
|
// publish the tx via mempool nodes.
|
||||||
|
MemPoolSpaceTxBroadcaster.broadcastTx(sendResult.tx);
|
||||||
|
|
||||||
|
Futures.addCallback(sendResult.broadcastComplete, new FutureCallback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Transaction result) {
|
public void onSuccess(Transaction result) {
|
||||||
log.info("emptyBtcWallet onSuccess Transaction=" + result);
|
log.info("emptyBtcWallet onSuccess Transaction=" + result);
|
||||||
|
|
Loading…
Add table
Reference in a new issue