mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Merge pull request #4958 from chimp1984/disable-tx-broadcast-if-connected-to-local-node
Do not use tx broadcast to mempool nodes if a local btc nodes is used
This commit is contained in:
commit
25328167de
2 changed files with 12 additions and 2 deletions
|
@ -234,7 +234,7 @@ public class BisqSetup {
|
|||
this.localBitcoinNode = localBitcoinNode;
|
||||
this.appStartupState = appStartupState;
|
||||
|
||||
MemPoolSpaceTxBroadcaster.init(socks5ProxyProvider, preferences);
|
||||
MemPoolSpaceTxBroadcaster.init(socks5ProxyProvider, preferences, localBitcoinNode);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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;
|
||||
|
@ -50,13 +51,16 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
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) {
|
||||
|
@ -65,6 +69,12 @@ public class MemPoolSpaceTxBroadcaster {
|
|||
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue