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

Do not use tx broadcast to mempool nodes if a local btc nodes is used #4958

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/java/bisq/core/app/BisqSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public BisqSetup(DomainInitialisation domainInitialisation,
this.localBitcoinNode = localBitcoinNode;
this.appStartupState = appStartupState;

MemPoolSpaceTxBroadcaster.init(socks5ProxyProvider, preferences);
MemPoolSpaceTxBroadcaster.init(socks5ProxyProvider, preferences, localBitcoinNode);
}

///////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package bisq.core.btc.wallet.http;

import bisq.core.btc.nodes.LocalBitcoinNode;
import bisq.core.user.Preferences;

import bisq.network.Socks5ProxyProvider;
Expand Down Expand Up @@ -50,13 +51,16 @@
public class MemPoolSpaceTxBroadcaster {
private static Socks5ProxyProvider socks5ProxyProvider;
private static Preferences preferences;
private static LocalBitcoinNode localBitcoinNode;
private static final ListeningExecutorService executorService = Utilities.getListeningExecutorService(
"MemPoolSpaceTxBroadcaster", 3, 5, 10 * 60);

public static void init(Socks5ProxyProvider socks5ProxyProvider,
Preferences preferences) {
Preferences preferences,
LocalBitcoinNode localBitcoinNode) {
MemPoolSpaceTxBroadcaster.socks5ProxyProvider = socks5ProxyProvider;
MemPoolSpaceTxBroadcaster.preferences = preferences;
MemPoolSpaceTxBroadcaster.localBitcoinNode = localBitcoinNode;
}

public static void broadcastTx(Transaction tx) {
Expand All @@ -65,6 +69,12 @@ public static void broadcastTx(Transaction tx) {
return;
}

if (localBitcoinNode.shouldBeUsed()) {
log.info("A localBitcoinNode is detected and used. For privacy reasons we do not use the tx " +
"broadcast to mempool nodes in that case.");
return;
}

if (socks5ProxyProvider == null) {
log.warn("We got broadcastTx called before init was called.");
return;
Expand Down