mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-18 05:12:42 +01:00
Refactor baseCurrencyNetwork field to getter access
This commit is contained in:
parent
f079e26e09
commit
ba333f225c
@ -75,7 +75,7 @@ public class SimpleHttpServer {
|
||||
started = new Date().toString();
|
||||
providedBtcNodes = peerConncetionModel.getProvidedBtcNodes();
|
||||
|
||||
BaseCurrencyNetwork network = config.baseCurrencyNetwork;
|
||||
BaseCurrencyNetwork network = config.getBaseCurrencyNetwork();
|
||||
if (config.useTorForBtcMonitor) {
|
||||
port = network.isMainnet() ? 8000 : 8001;
|
||||
networkInfo = network.isMainnet() ? "TOR/MAIN_NET" : "TOR/REG_TEST";
|
||||
|
@ -57,7 +57,7 @@ public class ProxySetup {
|
||||
socksProxyFactory = new SocksProxyFactory("127.0.0.1");
|
||||
Socks5ProxyProvider socks5ProxyProvider = new Socks5ProxyProvider("", "");
|
||||
socks5ProxyProvider.setSocks5ProxyInternal(socksProxyFactory);
|
||||
String networkDirName = config.baseCurrencyNetwork.name().toLowerCase();
|
||||
String networkDirName = config.getBaseCurrencyNetwork().name().toLowerCase();
|
||||
torDir = Paths.get(config.appDataDir.getPath(), networkDirName, "tor").toFile();
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ import java.util.Optional;
|
||||
import ch.qos.logback.classic.Level;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static java.lang.String.format;
|
||||
@ -178,7 +179,8 @@ public class Config {
|
||||
public final List<String> bannedPriceRelayNodes;
|
||||
public final List<String> bannedSeedNodes;
|
||||
public final List<String> filterProvidedSeedNodes;
|
||||
public final BaseCurrencyNetwork baseCurrencyNetwork;
|
||||
@Getter
|
||||
private final BaseCurrencyNetwork baseCurrencyNetwork;
|
||||
public final NetworkParameters networkParameters;
|
||||
public final boolean ignoreLocalBtcNode;
|
||||
public final String bitcoinRegtestHost;
|
||||
|
@ -52,7 +52,7 @@ public class CommonSetup {
|
||||
public static void setup(Config config, GracefulShutDownHandler gracefulShutDownHandler) {
|
||||
setupLog(config);
|
||||
AsciiLogo.showAsciiLogo();
|
||||
Version.setBaseCryptoNetworkId(config.baseCurrencyNetwork.ordinal());
|
||||
Version.setBaseCryptoNetworkId(config.getBaseCurrencyNetwork().ordinal());
|
||||
Version.printVersion();
|
||||
maybePrintPathOfCodeSource();
|
||||
Profiler.printSystemLoad();
|
||||
|
@ -82,8 +82,8 @@ class CoreDisputeAgentsService {
|
||||
if (!p2PService.isBootstrapped())
|
||||
throw new NotAvailableException("p2p service is not bootstrapped yet");
|
||||
|
||||
if (config.baseCurrencyNetwork.isMainnet()
|
||||
|| config.baseCurrencyNetwork.isDaoBetaNet()
|
||||
if (config.getBaseCurrencyNetwork().isMainnet()
|
||||
|| config.getBaseCurrencyNetwork().isDaoBetaNet()
|
||||
|| !config.useLocalhostForP2P)
|
||||
throw new UnsupportedOperationException("dispute agents must be registered in a Bisq UI");
|
||||
|
||||
|
@ -380,7 +380,7 @@ public class BisqSetup {
|
||||
}
|
||||
|
||||
private void readMapsFromResources(Runnable completeHandler) {
|
||||
String postFix = "_" + config.baseCurrencyNetwork.name();
|
||||
String postFix = "_" + config.getBaseCurrencyNetwork().name();
|
||||
p2PService.getP2PDataStorage().readFromResources(postFix, completeHandler);
|
||||
}
|
||||
|
||||
|
@ -284,6 +284,6 @@ public class WalletAppSetup {
|
||||
postFix = " " + Res.get("mainView.footer.usingTor");
|
||||
else
|
||||
postFix = "";
|
||||
return Res.get(config.baseCurrencyNetwork.name()) + postFix;
|
||||
return Res.get(config.getBaseCurrencyNetwork().name()) + postFix;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public abstract class AppSetup {
|
||||
// we need to reference it so the seed node stores tradeStatistics
|
||||
this.config = config;
|
||||
|
||||
Version.setBaseCryptoNetworkId(this.config.baseCurrencyNetwork.ordinal());
|
||||
Version.setBaseCryptoNetworkId(this.config.getBaseCurrencyNetwork().ordinal());
|
||||
Version.printVersion();
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class AppSetupWithP2P extends AppSetup {
|
||||
|
||||
@Override
|
||||
protected void initBasicServices() {
|
||||
String postFix = "_" + config.baseCurrencyNetwork.name();
|
||||
String postFix = "_" + config.getBaseCurrencyNetwork().name();
|
||||
p2PDataStorage.readFromResources(postFix, this::startInitP2PNetwork);
|
||||
}
|
||||
|
||||
|
@ -57,9 +57,9 @@ public class BitcoinModule extends AppModule {
|
||||
// otherwise the specified host or default (localhost)
|
||||
String regTestHost = config.bitcoinRegtestHost;
|
||||
if (regTestHost.isEmpty()) {
|
||||
regTestHost = config.baseCurrencyNetwork.isDaoTestNet() ?
|
||||
regTestHost = config.getBaseCurrencyNetwork().isDaoTestNet() ?
|
||||
"104.248.31.39" :
|
||||
config.baseCurrencyNetwork.isDaoRegTest() ?
|
||||
config.getBaseCurrencyNetwork().isDaoRegTest() ?
|
||||
"134.209.242.206" :
|
||||
Config.DEFAULT_REGTEST_HOST;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class LocalBitcoinNode {
|
||||
* Returns whether Bisq should ignore a local Bitcoin node even if it is usable.
|
||||
*/
|
||||
public boolean shouldBeIgnored() {
|
||||
BaseCurrencyNetwork baseCurrencyNetwork = config.baseCurrencyNetwork;
|
||||
BaseCurrencyNetwork baseCurrencyNetwork = config.getBaseCurrencyNetwork();
|
||||
|
||||
// For dao testnet (server side regtest) we disable the use of local bitcoin node
|
||||
// to avoid confusion if local btc node is not synced with our dao testnet master
|
||||
|
@ -172,7 +172,7 @@ public class WalletsSetup {
|
||||
this.socks5DiscoverMode = evaluateMode(socks5DiscoverModeString);
|
||||
this.walletDir = walletDir;
|
||||
|
||||
btcWalletFileName = "bisq_" + config.baseCurrencyNetwork.getCurrencyCode() + ".wallet";
|
||||
btcWalletFileName = "bisq_" + config.getBaseCurrencyNetwork().getCurrencyCode() + ".wallet";
|
||||
params = Config.baseCurrencyNetworkParameters();
|
||||
PeerGroup.setIgnoreHttpSeeds(true);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public class DaoStateSnapshotService implements DaoSetupService, DaoStateListene
|
||||
|
||||
@Override
|
||||
public void onParseBlockCompleteAfterBatchProcessing(Block block) {
|
||||
if (config.baseCurrencyNetwork.isMainnet() &&
|
||||
if (config.getBaseCurrencyNetwork().isMainnet() &&
|
||||
walletsSetup.isDownloadComplete() &&
|
||||
daoStateService.getChainHeight() == bsqWalletService.getBestChainHeight()) {
|
||||
// In case the DAO state is invalid we might get an outdated RECIPIENT_BTC_ADDRESS. In that case we trigger
|
||||
|
@ -71,7 +71,7 @@ public class DefaultSeedNodeRepository implements SeedNodeRepository {
|
||||
}
|
||||
|
||||
cache.clear();
|
||||
List<NodeAddress> result = getSeedNodeAddressesFromPropertyFile(config.baseCurrencyNetwork.name().toLowerCase(Locale.ENGLISH));
|
||||
List<NodeAddress> result = getSeedNodeAddressesFromPropertyFile(config.getBaseCurrencyNetwork().name().toLowerCase(Locale.ENGLISH));
|
||||
cache.addAll(result);
|
||||
|
||||
Set<NodeAddress> filterProvidedSeedNodes = config.filterProvidedSeedNodes.stream()
|
||||
|
@ -90,7 +90,7 @@ public class PriceFeedNodeAddressProvider {
|
||||
baseUrl = providerList.get(index);
|
||||
index++;
|
||||
|
||||
if (providerList.size() == 1 && config.baseCurrencyNetwork.isMainnet())
|
||||
if (providerList.size() == 1 && config.getBaseCurrencyNetwork().isMainnet())
|
||||
log.warn("We only have one provider");
|
||||
} else {
|
||||
baseUrl = "";
|
||||
|
Loading…
Reference in New Issue
Block a user