From 609b8b066d717396ccda152b6921e61b045a1375 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 9 Apr 2020 18:05:49 +0200 Subject: [PATCH] Limit abuse of useLocalhostForP2P option Until now, the --useLocalhostForP2P option could be used even for BTC_MAINNET. That is bad and caused mediation cases. --- common/src/main/java/bisq/common/config/Config.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/bisq/common/config/Config.java b/common/src/main/java/bisq/common/config/Config.java index 34928a1019e..d58780580f7 100644 --- a/common/src/main/java/bisq/common/config/Config.java +++ b/common/src/main/java/bisq/common/config/Config.java @@ -392,7 +392,8 @@ public Config(String defaultAppName, File defaultUserDataDir, String... args) { .describedAs("host:port[,...]"); ArgumentAcceptingOptionSpec useLocalhostForP2POpt = - parser.accepts(USE_LOCALHOST_FOR_P2P, "Use localhost P2P network for development") + parser.accepts(USE_LOCALHOST_FOR_P2P, "Use localhost P2P network for development. Only available for non-BTC_MAINNET configuration.") + .availableIf(BASE_CURRENCY_NETWORK) .withRequiredArg() .ofType(boolean.class) .defaultsTo(false); @@ -687,7 +688,7 @@ public Config(String defaultAppName, File defaultUserDataDir, String... args) { this.providers = options.valuesOf(providersOpt); this.seedNodes = options.valuesOf(seedNodesOpt); this.banList = options.valuesOf(banListOpt); - this.useLocalhostForP2P = options.valueOf(useLocalhostForP2POpt); + this.useLocalhostForP2P = this.baseCurrencyNetwork.isMainnet() ? false : options.valueOf(useLocalhostForP2POpt); this.maxConnections = options.valueOf(maxConnectionsOpt); this.socks5ProxyBtcAddress = options.valueOf(socks5ProxyBtcAddressOpt); this.socks5ProxyHttpAddress = options.valueOf(socks5ProxyHttpAddressOpt);