Skip to content

Commit

Permalink
Do not use tx broadcast to mempool nodes if a local btc nodes is used
Browse files Browse the repository at this point in the history
See discussion at: #4943 (comment)
  • Loading branch information
chimp1984 committed Dec 15, 2020
1 parent f61e62c commit 4b986ab
Showing 1 changed file with 11 additions and 1 deletion.
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

0 comments on commit 4b986ab

Please sign in to comment.