Introduce and document static Config.baseCurrencyNetwork()

Previously this static property had been managed within
BaseCurrencyNetwork itself and was accessed directly by callers. Now it
is managed within Config, made private and accessed only via the
new and well-documented baseCurrencyNetwork() method. The same goes for
baseCurrencyNetworkParameters().

It is unfortunate that we must retain these mutable static fields and
accessors, but after trying to eliminate them entirely, this approach is
the lesser of two evils; attempting to use a Config instance and
instance methods only ends up being quite cumbersome to implement,
requiring Config to be injected into many more classes than it currently
is. Getting access to the BaseCurrencyNetwork is basically a special
case, and treating it specially as a static field is in the end the most
pragmatic approach.
This commit is contained in:
Chris Beams 2020-01-08 12:43:01 +01:00
parent 3a6b0ce9d8
commit 42a037e19f
No known key found for this signature in database
GPG Key ID: 3D214F8F5BC5ED73
49 changed files with 174 additions and 136 deletions

View File

@ -32,9 +32,6 @@ public enum BaseCurrencyNetwork {
BTC_DAO_BETANET(MainNetParams.get(), "BTC", "MAINNET", "Bitcoin"), // mainnet test genesis
BTC_DAO_REGTEST(RegTestParams.get(), "BTC", "REGTEST", "Bitcoin"); // server side regtest after v0.9.5, had breaking code changes so we started over again
public static BaseCurrencyNetwork CURRENT_NETWORK = BTC_MAINNET;
public static NetworkParameters CURRENT_PARAMETERS = CURRENT_NETWORK.getParameters();
@Getter
private final NetworkParameters parameters;
@Getter

View File

@ -2,6 +2,8 @@ package bisq.common.config;
import bisq.common.util.Utilities;
import org.bitcoinj.core.NetworkParameters;
import joptsimple.AbstractOptionSpec;
import joptsimple.ArgumentAcceptingOptionSpec;
import joptsimple.HelpFormatter;
@ -92,6 +94,7 @@ public class Config {
// Overlay.addReportErrorButtons. avoids the need to inject config into all Overlay
// subclasses. TODO: do the injection anyway
public static File CURRENT_APP_DATA_DIR;
private static BaseCurrencyNetwork BASE_CURRENCY_NETWORK_VALUE = BaseCurrencyNetwork.BTC_MAINNET;
// default data dir properties
private final String defaultAppName;
@ -111,6 +114,7 @@ public class Config {
private final List<String> bannedPriceRelayNodes;
private final List<String> bannedSeedNodes;
private final BaseCurrencyNetwork baseCurrencyNetwork;
private final NetworkParameters baseCurrencyNetworkParameters;
private final boolean ignoreLocalBtcNode;
private final String bitcoinRegtestHost;
private final boolean daoActivated;
@ -570,6 +574,7 @@ public class Config {
this.bannedPriceRelayNodes = options.valuesOf(bannedPriceRelayNodesOpt);
this.bannedSeedNodes = options.valuesOf(bannedSeedNodesOpt);
this.baseCurrencyNetwork = (BaseCurrencyNetwork) options.valueOf(baseCurrencyNetworkOpt);
this.baseCurrencyNetworkParameters = baseCurrencyNetwork.getParameters();
this.ignoreLocalBtcNode = options.valueOf(ignoreLocalBtcNodeOpt);
this.bitcoinRegtestHost = options.valueOf(bitcoinRegtestHostOpt);
this.logLevel = options.valueOf(logLevelOpt);
@ -635,8 +640,7 @@ public class Config {
// assign values to legacy mutable static fields
CURRENT_APP_DATA_DIR = appDataDir;
BaseCurrencyNetwork.CURRENT_NETWORK = baseCurrencyNetwork;
BaseCurrencyNetwork.CURRENT_PARAMETERS = baseCurrencyNetwork.getParameters();
BASE_CURRENCY_NETWORK_VALUE = baseCurrencyNetwork;
}
private Optional<OptionSet> parseOptionsFrom(File file, OptionParser parser, OptionSpec<?>... disallowedOpts) {
@ -733,6 +737,33 @@ public class Config {
}
// == STATIC ACCESSORS ======================================================================
/**
* Static accessor that returns either the default base currency network value of
* {@link BaseCurrencyNetwork#BTC_MAINNET} or the value assigned via the
* {@value BASE_CURRENCY_NETWORK} option. The non-static
* {@link #getBaseCurrencyNetwork()} accessor should be favored whenever possible and
* this static accessor should be used only in code locations where it is infeasible
* or too cumbersome to inject the normal Guice-managed singleton {@link Config}
* instance.
*/
public static BaseCurrencyNetwork baseCurrencyNetwork() {
return BASE_CURRENCY_NETWORK_VALUE;
}
/**
* Static accessor that returns the value of
* {@code baseCurrencyNetwork().getParameters()} for convenience and to avoid violating
* the <a href="https://en.wikipedia.org/wiki/Law_of_Demeter">Law of Demeter</a>. The
* non-static {@link #getBaseCurrencyNetwork()} method should be favored whenever
* possible.
* @see #baseCurrencyNetwork()
*/
public static NetworkParameters baseCurrencyNetworkParameters() {
return BASE_CURRENCY_NETWORK_VALUE.getParameters();
}
// == ACCESSORS ======================================================================
public String getDefaultAppName() {
@ -791,6 +822,10 @@ public class Config {
return baseCurrencyNetwork;
}
public NetworkParameters getBaseCurrencyNetworkParameters() {
return baseCurrencyNetworkParameters;
}
public boolean isIgnoreLocalBtcNode() {
return ignoreLocalBtcNode;
}

View File

@ -38,7 +38,6 @@ import bisq.network.p2p.network.BridgeAddressProvider;
import bisq.network.p2p.seed.SeedNodeRepository;
import bisq.common.app.AppModule;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.crypto.PubKeyRing;
import bisq.common.crypto.PubKeyRingProvider;
@ -66,7 +65,7 @@ public class CoreModule extends AppModule {
bind(File.class).annotatedWith(named(STORAGE_DIR)).toInstance(config.getStorageDir());
CoinFormatter btcFormatter = new ImmutableCoinFormatter(BaseCurrencyNetwork.CURRENT_PARAMETERS.getMonetaryFormat());
CoinFormatter btcFormatter = new ImmutableCoinFormatter(config.getBaseCurrencyNetworkParameters().getMonetaryFormat());
bind(CoinFormatter.class).annotatedWith(named(FormattingUtils.BTC_FORMATTER_KEY)).toInstance(btcFormatter);
bind(File.class).annotatedWith(named(KEY_STORAGE_DIR)).toInstance(config.getKeyStorageDir());

View File

@ -17,7 +17,7 @@
package bisq.core.btc.model;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.proto.ProtoUtil;
import bisq.common.proto.persistable.PersistablePayload;
import bisq.common.util.Utilities;
@ -174,7 +174,7 @@ public final class AddressEntry implements PersistablePayload {
@Nullable
public Address getAddress() {
if (address == null && keyPair != null)
address = keyPair.toAddress(BaseCurrencyNetwork.CURRENT_PARAMETERS);
address = keyPair.toAddress(Config.baseCurrencyNetworkParameters());
return address;
}

View File

@ -21,7 +21,7 @@ import bisq.core.btc.setup.WalletConfig;
import bisq.network.Socks5MultiDiscovery;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.PeerAddress;
@ -69,7 +69,7 @@ public class BtcNetworkConfig {
}
// SeedPeers uses hard coded stable addresses (from MainNetParams). It should be updated from time to time.
delegate.setDiscovery(new Socks5MultiDiscovery(proxy, parameters, socks5DiscoverMode));
} else if (BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet()) {
} else if (Config.baseCurrencyNetwork().isMainnet()) {
log.warn("You don't use tor and use the public Bitcoin network and are exposed to privacy issues " +
"caused by the broken bloom filters. See https://bisq.network/blog/privacy-in-bitsquare/ " +
"for more info. It is recommended to use Tor and the provided nodes.");

View File

@ -17,7 +17,7 @@
package bisq.core.btc.nodes;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import java.util.ArrayList;
import java.util.Arrays;
@ -87,7 +87,7 @@ public class BtcNodes {
}
public boolean useProvidedBtcNodes() {
return BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet();
return Config.baseCurrencyNetwork().isMainnet();
}
public static List<BtcNodes.BtcNode> toBtcNodesList(Collection<String> nodes) {
@ -100,7 +100,7 @@ public class BtcNodes {
@EqualsAndHashCode
@Getter
public static class BtcNode {
private static final int DEFAULT_PORT = BaseCurrencyNetwork.CURRENT_PARAMETERS.getPort(); //8333
private static final int DEFAULT_PORT = Config.baseCurrencyNetworkParameters().getPort(); //8333
@Nullable
private final String onionAddress;

View File

@ -21,7 +21,6 @@ import bisq.core.btc.nodes.ProxySocketFactory;
import bisq.core.btc.wallet.BisqRiskAnalysis;
import bisq.common.app.Version;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.bitcoinj.core.BlockChain;
@ -238,8 +237,8 @@ public class WalletConfig extends AbstractIdleService {
// For dao testnet (server side regtest) we prevent to connect to a localhost node to avoid confusion
// if local btc node is not synced with our dao testnet master node.
if (BaseCurrencyNetwork.CURRENT_NETWORK.isDaoRegTest() ||
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoTestNet() ||
if (Config.baseCurrencyNetwork().isDaoRegTest() ||
Config.baseCurrencyNetwork().isDaoTestNet() ||
!config.isLocalBitcoinNodeIsRunning())
peerGroup.setUseLocalhostPeerWhenPossible(false);

View File

@ -33,7 +33,6 @@ import bisq.network.Socks5ProxyProvider;
import bisq.common.Timer;
import bisq.common.UserThread;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.handlers.ExceptionHandler;
import bisq.common.handlers.ResultHandler;
@ -165,7 +164,7 @@ public class WalletsSetup {
this.walletDir = walletDir;
btcWalletFileName = "bisq_" + config.getBaseCurrencyNetwork().getCurrencyCode() + ".wallet";
params = BaseCurrencyNetwork.CURRENT_PARAMETERS;
params = Config.baseCurrencyNetworkParameters();
PeerGroup.setIgnoreHttpSeeds(true);
}

View File

@ -17,7 +17,7 @@
package bisq.core.btc.wallet;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.bitcoinj.core.Coin;
@ -33,7 +33,7 @@ public class Restrictions {
public static Coin getMinNonDustOutput() {
if (minNonDustOutput == null)
minNonDustOutput = BaseCurrencyNetwork.CURRENT_NETWORK.getParameters().getMinNonDustOutput();
minNonDustOutput = Config.baseCurrencyNetwork().getParameters().getMinNonDustOutput();
return minNonDustOutput;
}

View File

@ -29,7 +29,7 @@ import bisq.core.btc.setup.WalletsSetup;
import bisq.core.locale.Res;
import bisq.core.user.Preferences;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.AddressFormatException;
@ -93,7 +93,7 @@ public class TradeWalletService {
public TradeWalletService(WalletsSetup walletsSetup, Preferences preferences) {
this.walletsSetup = walletsSetup;
this.preferences = preferences;
this.params = BaseCurrencyNetwork.CURRENT_PARAMETERS;
this.params = Config.baseCurrencyNetworkParameters();
walletsSetup.addSetupCompletedHandler(() -> {
walletConfig = walletsSetup.getWalletConfig();
wallet = walletsSetup.getBtcWallet();

View File

@ -26,7 +26,7 @@ import bisq.core.btc.setup.WalletsSetup;
import bisq.core.provider.fee.FeeService;
import bisq.core.user.Preferences;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.handlers.ErrorMessageHandler;
import bisq.common.handlers.ResultHandler;
@ -677,13 +677,13 @@ public abstract class WalletService {
@Nullable
public static Address getAddressFromOutput(TransactionOutput output) {
return isOutputScriptConvertibleToAddress(output) ?
output.getScriptPubKey().getToAddress(BaseCurrencyNetwork.CURRENT_PARAMETERS) : null;
output.getScriptPubKey().getToAddress(Config.baseCurrencyNetworkParameters()) : null;
}
@Nullable
public static String getAddressStringFromOutput(TransactionOutput output) {
return isOutputScriptConvertibleToAddress(output) ?
output.getScriptPubKey().getToAddress(BaseCurrencyNetwork.CURRENT_PARAMETERS).toString() : null;
output.getScriptPubKey().getToAddress(Config.baseCurrencyNetworkParameters()).toString() : null;
}

View File

@ -47,7 +47,7 @@ import bisq.network.p2p.P2PService;
import bisq.common.UserThread;
import bisq.common.app.DevEnv;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.crypto.CryptoException;
import bisq.common.handlers.ErrorMessageHandler;
import bisq.common.handlers.ExceptionHandler;
@ -368,9 +368,9 @@ public class MyBlindVoteListService implements PersistedDataHost, DaoStateListen
// Republishing only will have effect if the payload creation date is < 5 hours as other nodes would not
// accept payloads which are too old or are in future.
// Only payloads received from seed nodes would ignore that date check.
int minPeers = BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet() ? 4 : 1;
int minPeers = Config.baseCurrencyNetwork().isMainnet() ? 4 : 1;
if ((p2PService.getNumConnectedPeers().get() >= minPeers && p2PService.isBootstrapped()) ||
BaseCurrencyNetwork.CURRENT_NETWORK.isRegtest()) {
Config.baseCurrencyNetwork().isRegtest()) {
myBlindVoteList.stream()
.filter(blindVote -> periodService.isTxInPhaseAndCycle(blindVote.getTxId(),
DaoPhase.Phase.BLIND_VOTE,

View File

@ -19,7 +19,7 @@ package bisq.core.dao.governance.param;
import bisq.core.locale.Res;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.proto.ProtoUtil;
import lombok.Getter;
@ -106,9 +106,9 @@ public enum Param {
// the time locked payout tx in case the traders do not cooperate. Will be likely a donation address (Bisq, Tor,...)
// but can be also a burner address if we prefer to burn the BTC
@SuppressWarnings("SpellCheckingInspection")
RECIPIENT_BTC_ADDRESS(BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet() ? "1BVxNn3T12veSK6DgqwU4Hdn7QHcDDRag7" : // mainnet
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoBetaNet() ? "1BVxNn3T12veSK6DgqwU4Hdn7QHcDDRag7" : // daoBetaNet
BaseCurrencyNetwork.CURRENT_NETWORK.isTestnet() ? "2N4mVTpUZAnhm9phnxB7VrHB4aBhnWrcUrV" : // testnet
RECIPIENT_BTC_ADDRESS(Config.baseCurrencyNetwork().isMainnet() ? "1BVxNn3T12veSK6DgqwU4Hdn7QHcDDRag7" : // mainnet
Config.baseCurrencyNetwork().isDaoBetaNet() ? "1BVxNn3T12veSK6DgqwU4Hdn7QHcDDRag7" : // daoBetaNet
Config.baseCurrencyNetwork().isTestnet() ? "2N4mVTpUZAnhm9phnxB7VrHB4aBhnWrcUrV" : // testnet
"2MzBNTJDjjXgViKBGnatDU3yWkJ8pJkEg9w", // regtest or DAO testnet (regtest)
ParamType.ADDRESS),
@ -136,73 +136,73 @@ public enum Param {
// For testnet we want to have a short cycle of about a week (1012 blocks)
// For regtest we use very short periods
PHASE_UNDEFINED("0", ParamType.BLOCK),
PHASE_PROPOSAL(BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet() ?
PHASE_PROPOSAL(Config.baseCurrencyNetwork().isMainnet() ?
"3601" : // mainnet; 24 days
BaseCurrencyNetwork.CURRENT_NETWORK.isRegtest() ?
Config.baseCurrencyNetwork().isRegtest() ?
"4" : // regtest
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoBetaNet() ?
Config.baseCurrencyNetwork().isDaoBetaNet() ?
"144" : // daoBetaNet; 1 day
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoRegTest() ?
Config.baseCurrencyNetwork().isDaoRegTest() ?
"134" : // dao regtest; 0.93 days
"380", // testnet or dao testnet (server side regtest); 2.6 days
ParamType.BLOCK, 2, 2),
PHASE_BREAK1(BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet() ?
PHASE_BREAK1(Config.baseCurrencyNetwork().isMainnet() ?
"149" : // mainnet; 1 day
BaseCurrencyNetwork.CURRENT_NETWORK.isRegtest() ?
Config.baseCurrencyNetwork().isRegtest() ?
"1" : // regtest
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoBetaNet() ?
Config.baseCurrencyNetwork().isDaoBetaNet() ?
"10" : // daoBetaNet
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoRegTest() ?
Config.baseCurrencyNetwork().isDaoRegTest() ?
"10" : // dao regtest
"10", // testnet or dao testnet (server side regtest)
ParamType.BLOCK, 2, 2),
PHASE_BLIND_VOTE(BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet() ?
PHASE_BLIND_VOTE(Config.baseCurrencyNetwork().isMainnet() ?
"451" : // mainnet; 3 days
BaseCurrencyNetwork.CURRENT_NETWORK.isRegtest() ?
Config.baseCurrencyNetwork().isRegtest() ?
"2" : // regtest
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoBetaNet() ?
Config.baseCurrencyNetwork().isDaoBetaNet() ?
"144" : // daoBetaNet; 1 day
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoRegTest() ?
Config.baseCurrencyNetwork().isDaoRegTest() ?
"134" : // dao regtest; 0.93 days
"300", // testnet or dao testnet (server side regtest); 2 days
ParamType.BLOCK, 2, 2),
PHASE_BREAK2(BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet() ?
PHASE_BREAK2(Config.baseCurrencyNetwork().isMainnet() ?
"9" : // mainnet
BaseCurrencyNetwork.CURRENT_NETWORK.isRegtest() ?
Config.baseCurrencyNetwork().isRegtest() ?
"1" : // regtest
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoBetaNet() ?
Config.baseCurrencyNetwork().isDaoBetaNet() ?
"10" : // daoBetaNet
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoRegTest() ?
Config.baseCurrencyNetwork().isDaoRegTest() ?
"10" : // dao regtest
"10", // testnet or dao testnet (server side regtest)
ParamType.BLOCK, 2, 2),
PHASE_VOTE_REVEAL(BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet() ?
PHASE_VOTE_REVEAL(Config.baseCurrencyNetwork().isMainnet() ?
"451" : // mainnet; 3 days
BaseCurrencyNetwork.CURRENT_NETWORK.isRegtest() ?
Config.baseCurrencyNetwork().isRegtest() ?
"2" : // regtest
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoBetaNet() ?
Config.baseCurrencyNetwork().isDaoBetaNet() ?
"144" : // daoBetaNet; 1 day
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoRegTest() ?
Config.baseCurrencyNetwork().isDaoRegTest() ?
"132" : // dao regtest; 0.93 days
"300", // testnet or dao testnet (server side regtest); 2 days
ParamType.BLOCK, 2, 2),
PHASE_BREAK3(BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet() ?
PHASE_BREAK3(Config.baseCurrencyNetwork().isMainnet() ?
"9" : // mainnet
BaseCurrencyNetwork.CURRENT_NETWORK.isRegtest() ?
Config.baseCurrencyNetwork().isRegtest() ?
"1" : // regtest
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoBetaNet() ?
Config.baseCurrencyNetwork().isDaoBetaNet() ?
"10" : // daoBetaNet
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoRegTest() ?
Config.baseCurrencyNetwork().isDaoRegTest() ?
"10" : // dao regtest
"10", // testnet or dao testnet (server side regtest)
ParamType.BLOCK, 2, 2),
PHASE_RESULT(BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet() ?
PHASE_RESULT(Config.baseCurrencyNetwork().isMainnet() ?
"10" : // mainnet
BaseCurrencyNetwork.CURRENT_NETWORK.isRegtest() ?
Config.baseCurrencyNetwork().isRegtest() ?
"2" : // regtest
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoBetaNet() ?
Config.baseCurrencyNetwork().isDaoBetaNet() ?
"10" : // daoBetaNet
BaseCurrencyNetwork.CURRENT_NETWORK.isDaoRegTest() ?
Config.baseCurrencyNetwork().isDaoRegTest() ?
"2" : // dao regtest
"2", // testnet or dao testnet (server side regtest)
ParamType.BLOCK, 2, 2);

View File

@ -31,7 +31,7 @@ import bisq.network.p2p.P2PService;
import bisq.common.UserThread;
import bisq.common.app.DevEnv;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.crypto.PubKeyRing;
import bisq.common.handlers.ErrorMessageHandler;
import bisq.common.handlers.ResultHandler;
@ -220,9 +220,9 @@ public class MyProposalListService implements PersistedDataHost, DaoStateListene
private void rePublishMyProposalsOnceWellConnected() {
// We republish at each startup at any block during the cycle. We filter anyway for valid blind votes
// of that cycle so it is 1 blind vote getting rebroadcast at each startup to my neighbors.
int minPeers = BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet() ? 4 : 1;
int minPeers = Config.baseCurrencyNetwork().isMainnet() ? 4 : 1;
if ((p2PService.getNumConnectedPeers().get() >= minPeers && p2PService.isBootstrapped()) ||
BaseCurrencyNetwork.CURRENT_NETWORK.isRegtest()) {
Config.baseCurrencyNetwork().isRegtest()) {
myProposalList.stream()
.filter(proposal -> periodService.isTxInPhaseAndCycle(proposal.getTxId(),
DaoPhase.Phase.PROPOSAL,

View File

@ -31,7 +31,7 @@ import bisq.core.util.coin.BsqFormatter;
import bisq.core.util.validation.BtcAddressValidator;
import bisq.core.util.validation.InputValidator;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.bitcoinj.core.Coin;
@ -213,7 +213,7 @@ public class ChangeParamValidator extends ProposalValidator implements Consensus
}
private void validateBlockValue(int currentParamValueAsBlock, int inputValueAsBlock, Param param) throws ParamValidationException {
boolean isMainnet = BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet();
boolean isMainnet = Config.baseCurrencyNetwork().isMainnet();
switch (param) {
case LOCK_TIME_TRADE_PAYOUT:
break;

View File

@ -22,7 +22,6 @@ import bisq.core.dao.state.model.blockchain.TxInput;
import bisq.core.user.Preferences;
import bisq.common.UserThread;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.handlers.ResultHandler;
import bisq.common.util.Utilities;
@ -102,9 +101,9 @@ public class RpcService {
// mainnet is 8332, testnet 18332, regtest 18443
boolean isHostSet = !rpcHost.isEmpty();
boolean isPortSet = rpcPort != Config.UNSPECIFIED_PORT;
boolean isMainnet = BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet();
boolean isTestnet = BaseCurrencyNetwork.CURRENT_NETWORK.isTestnet();
boolean isDaoBetaNet = BaseCurrencyNetwork.CURRENT_NETWORK.isDaoBetaNet();
boolean isMainnet = Config.baseCurrencyNetwork().isMainnet();
boolean isTestnet = Config.baseCurrencyNetwork().isTestnet();
boolean isDaoBetaNet = Config.baseCurrencyNetwork().isDaoBetaNet();
this.rpcHost = isHostSet ? rpcHost : "127.0.0.1";
this.rpcPort = isPortSet ? rpcPort :
isMainnet || isDaoBetaNet ? 8332 :

View File

@ -24,7 +24,7 @@ import bisq.core.dao.state.model.blockchain.OpReturnType;
import bisq.core.dao.state.model.blockchain.TxOutput;
import bisq.core.dao.state.model.blockchain.TxOutputType;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import com.google.common.annotations.VisibleForTesting;
@ -412,8 +412,8 @@ class TxOutputParser {
}
private int getActivateHardFork1Height() {
return BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet() ? ACTIVATE_HARD_FORK_1_HEIGHT_MAINNET :
BaseCurrencyNetwork.CURRENT_NETWORK.isTestnet() ? ACTIVATE_HARD_FORK_1_HEIGHT_TESTNET :
return Config.baseCurrencyNetwork().isMainnet() ? ACTIVATE_HARD_FORK_1_HEIGHT_MAINNET :
Config.baseCurrencyNetwork().isTestnet() ? ACTIVATE_HARD_FORK_1_HEIGHT_TESTNET :
ACTIVATE_HARD_FORK_1_HEIGHT_REGTEST;
}

View File

@ -106,7 +106,7 @@ public class GenesisTxInfo {
public GenesisTxInfo(@Named(Config.GENESIS_TX_ID) String genesisTxId,
@Named(Config.GENESIS_BLOCK_HEIGHT) int genesisBlockHeight,
@Named(Config.GENESIS_TOTAL_SUPPLY) long genesisTotalSupply) {
BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
boolean isMainnet = baseCurrencyNetwork.isMainnet();
boolean isTestnet = baseCurrencyNetwork.isTestnet();
boolean isDaoTestNet = baseCurrencyNetwork.isDaoTestNet();

View File

@ -19,7 +19,7 @@ package bisq.core.dao.state.model.governance;
import bisq.core.locale.Res;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import lombok.Getter;
@ -93,9 +93,9 @@ public enum BondedRoleType {
*/
BondedRoleType(long requiredBondUnit, int unlockTimeInDays, String link, boolean allowMultipleHolders) {
this.requiredBondUnit = requiredBondUnit;
this.unlockTimeInBlocks = BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet() ?
this.unlockTimeInBlocks = Config.baseCurrencyNetwork().isMainnet() ?
unlockTimeInDays * 144 : // mainnet (144 blocks per day)
BaseCurrencyNetwork.CURRENT_NETWORK.isRegtest() ?
Config.baseCurrencyNetwork().isRegtest() ?
5 : // regtest (arbitrarily low value for dev testing)
144; // testnet (relatively short time for testing purposes)
this.link = link;

View File

@ -24,7 +24,7 @@ import bisq.core.dao.state.model.ImmutableDaoStateModel;
import bisq.core.dao.state.model.blockchain.TxType;
import bisq.common.app.Version;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.util.CollectionUtils;
import org.bitcoinj.core.Address;
@ -120,7 +120,7 @@ public final class CompensationProposal extends Proposal implements IssuanceProp
public Address getAddress() throws AddressFormatException {
// Remove leading 'B'
String underlyingBtcAddress = bsqAddress.substring(1, bsqAddress.length());
return Address.fromBase58(BaseCurrencyNetwork.CURRENT_PARAMETERS, underlyingBtcAddress);
return Address.fromBase58(Config.baseCurrencyNetworkParameters(), underlyingBtcAddress);
}

View File

@ -24,7 +24,7 @@ import bisq.core.dao.state.model.ImmutableDaoStateModel;
import bisq.core.dao.state.model.blockchain.TxType;
import bisq.common.app.Version;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.util.CollectionUtils;
import org.bitcoinj.core.Address;
@ -120,7 +120,7 @@ public final class ReimbursementProposal extends Proposal implements IssuancePro
public Address getAddress() throws AddressFormatException {
// Remove leading 'B'
String underlyingBtcAddress = bsqAddress.substring(1, bsqAddress.length());
return Address.fromBase58(BaseCurrencyNetwork.CURRENT_PARAMETERS, underlyingBtcAddress);
return Address.fromBase58(Config.baseCurrencyNetworkParameters(), underlyingBtcAddress);
}

View File

@ -28,6 +28,7 @@ import bisq.asset.coins.BSQ;
import bisq.common.app.DevEnv;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import com.google.common.base.Suppliers;
@ -54,7 +55,7 @@ import static com.google.common.base.Preconditions.checkArgument;
public class CurrencyUtil {
public static void setup() {
setBaseCurrencyCode(BaseCurrencyNetwork.CURRENT_NETWORK.getCurrencyCode());
setBaseCurrencyCode(Config.baseCurrencyNetwork().getCurrencyCode());
}
private static final AssetRegistry assetRegistry = new AssetRegistry();
@ -118,8 +119,8 @@ public class CurrencyUtil {
public static Stream<Asset> getSortedAssetStream() {
return assetRegistry.stream()
.filter(CurrencyUtil::assetIsNotBaseCurrency)
.filter(asset -> isNotBsqOrBsqTradingActivated(asset, BaseCurrencyNetwork.CURRENT_NETWORK, DevEnv.isDaoTradingActivated()))
.filter(asset -> assetMatchesNetworkIfMainnet(asset, BaseCurrencyNetwork.CURRENT_NETWORK))
.filter(asset -> isNotBsqOrBsqTradingActivated(asset, Config.baseCurrencyNetwork(), DevEnv.isDaoTradingActivated()))
.filter(asset -> assetMatchesNetworkIfMainnet(asset, Config.baseCurrencyNetwork()))
.sorted(Comparator.comparing(Asset::getName));
}

View File

@ -20,6 +20,7 @@ package bisq.core.locale;
import bisq.common.UserThread;
import bisq.common.app.DevEnv;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.apache.commons.lang3.StringUtils;
@ -44,7 +45,7 @@ import org.jetbrains.annotations.NotNull;
@Slf4j
public class Res {
public static void setup() {
BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
setBaseCurrencyCode(baseCurrencyNetwork.getCurrencyCode());
setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());
}

View File

@ -26,7 +26,7 @@ import bisq.asset.Asset;
import bisq.asset.AssetRegistry;
import bisq.common.app.DevEnv;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import com.google.inject.Inject;
@ -56,7 +56,7 @@ public final class AltCoinAddressValidator extends InputValidator {
return validationResult;
Optional<Asset> optionalAsset = CurrencyUtil.findAsset(assetRegistry, currencyCode,
BaseCurrencyNetwork.CURRENT_NETWORK, DevEnv.isDaoTradingActivated());
Config.baseCurrencyNetwork(), DevEnv.isDaoTradingActivated());
if (optionalAsset.isPresent()) {
Asset asset = optionalAsset.get();
AddressValidationResult result = asset.validateAddress(input);

View File

@ -22,7 +22,7 @@ import bisq.core.dao.governance.period.PeriodService;
import bisq.core.dao.state.DaoStateService;
import bisq.common.UserThread;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.handlers.FaultHandler;
import bisq.common.util.Tuple2;
@ -117,7 +117,7 @@ public class FeeService {
///////////////////////////////////////////////////////////////////////////////////////////
public void onAllServicesInitialized() {
minFeePerByte = BaseCurrencyNetwork.CURRENT_NETWORK.getDefaultMinFeePerByte();
minFeePerByte = Config.baseCurrencyNetwork().getDefaultMinFeePerByte();
requestFees();

View File

@ -24,7 +24,7 @@ import bisq.network.p2p.P2PService;
import bisq.network.p2p.storage.HashMapChangedListener;
import bisq.common.app.DevEnv;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.handlers.ErrorMessageHandler;
import bisq.common.handlers.ResultHandler;
import bisq.common.util.Utilities;
@ -62,7 +62,7 @@ public abstract class DisputeAgentService<T extends DisputeAgent> {
ResultHandler resultHandler,
ErrorMessageHandler errorMessageHandler) {
log.debug("addDisputeAgent disputeAgent.hashCode() " + disputeAgent.hashCode());
if (!BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet() ||
if (!Config.baseCurrencyNetwork().isMainnet() ||
!Utilities.encodeToHex(disputeAgent.getRegistrationPubKey()).equals(DevEnv.DEV_PRIVILEGE_PUB_KEY)) {
boolean result = p2PService.addProtectedStorageEntry(disputeAgent);
if (result) {

View File

@ -20,7 +20,7 @@ package bisq.core.trade.protocol.tasks.maker;
import bisq.core.trade.Trade;
import bisq.core.trade.protocol.tasks.TradeTask;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.taskrunner.TaskRunner;
import lombok.extern.slf4j.Slf4j;
@ -39,7 +39,7 @@ public class MakerSetsLockTime extends TradeTask {
// 10 days for altcoins, 20 days for other payment methods
int delay = processModel.getOffer().getPaymentMethod().isAsset() ? 144 * 10 : 144 * 20;
if (BaseCurrencyNetwork.CURRENT_NETWORK.isRegtest()) {
if (Config.baseCurrencyNetwork().isRegtest()) {
delay = 5;
}

View File

@ -202,7 +202,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
@Override
public void readPersisted() {
PreferencesPayload persisted = storage.initAndGetPersistedWithFileName("PreferencesPayload", 100);
BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
TradeCurrency preferredTradeCurrency;
if (persisted != null) {
prefPayload = persisted;
@ -367,7 +367,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
}
public void setBlockChainExplorer(BlockChainExplorer blockChainExplorer) {
if (BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet())
if (Config.baseCurrencyNetwork().isMainnet())
setBlockChainExplorerMainNet(blockChainExplorer);
else
setBlockChainExplorerTestNet(blockChainExplorer);
@ -688,7 +688,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
}
public BlockChainExplorer getBlockChainExplorer() {
BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
switch (baseCurrencyNetwork) {
case BTC_MAINNET:
return prefPayload.getBlockChainExplorerMainNet();
@ -707,7 +707,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
}
public ArrayList<BlockChainExplorer> getBlockChainExplorers() {
BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
switch (baseCurrencyNetwork) {
case BTC_MAINNET:
return BTC_MAIN_NET_EXPLORERS;
@ -735,7 +735,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
// We override the useTorForBitcoinJ and set it to false if we detected a localhost node or if we are not on mainnet,
// unless the useTorForBtc parameter is explicitly provided.
// On testnet there are very few Bitcoin tor nodes and we don't provide tor nodes.
if ((!BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet()
if ((!Config.baseCurrencyNetwork().isMainnet()
|| config.isLocalBitcoinNodeIsRunning())
&& !config.isUseTorForBtcOptionSetExplicitly())
return false;
@ -767,7 +767,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
}
public long getWithdrawalTxFeeInBytes() {
return Math.max(prefPayload.getWithdrawalTxFeeInBytes(), BaseCurrencyNetwork.CURRENT_NETWORK.getDefaultMinFeePerByte());
return Math.max(prefPayload.getWithdrawalTxFeeInBytes(), Config.baseCurrencyNetwork().getDefaultMinFeePerByte());
}
public boolean isDaoFullNode() {

View File

@ -28,7 +28,7 @@ import bisq.core.util.validation.BtcAddressValidator;
import bisq.core.util.validation.InputValidator;
import bisq.common.app.DevEnv;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.util.MathUtils;
import org.bitcoinj.core.Address;
@ -72,7 +72,7 @@ public class BsqFormatter implements CoinFormatter {
@Inject
public BsqFormatter() {
this.btcCoinFormat = BaseCurrencyNetwork.CURRENT_PARAMETERS.getMonetaryFormat();
this.btcCoinFormat = Config.baseCurrencyNetworkParameters().getMonetaryFormat();
this.monetaryFormat = new MonetaryFormat().shift(6).code(6, "BSQ").minDecimals(2);
this.immutableCoinFormatter = new ImmutableCoinFormatter(monetaryFormat);
@ -110,7 +110,7 @@ public class BsqFormatter implements CoinFormatter {
encoded = encoded.substring(prefix.length(), encoded.length());
try {
return Address.fromBase58(BaseCurrencyNetwork.CURRENT_PARAMETERS, encoded);
return Address.fromBase58(Config.baseCurrencyNetworkParameters(), encoded);
} catch (AddressFormatException e) {
throw new RuntimeException(e);
}

View File

@ -19,7 +19,7 @@ package bisq.core.util.validation;
import bisq.core.locale.Res;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.AddressFormatException;
@ -44,7 +44,7 @@ public final class BtcAddressValidator extends InputValidator {
private ValidationResult validateBtcAddress(String input) {
try {
Address.fromBase58(BaseCurrencyNetwork.CURRENT_PARAMETERS, input);
Address.fromBase58(Config.baseCurrencyNetworkParameters(), input);
return new ValidationResult(true);
} catch (AddressFormatException e) {
return new ValidationResult(false, Res.get("validation.btc.invalidFormat"));

View File

@ -23,6 +23,7 @@ import bisq.core.locale.Res;
import bisq.asset.AssetRegistry;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.junit.Test;
@ -35,7 +36,7 @@ public class AltCoinAddressValidatorTest {
public void test() {
AltCoinAddressValidator validator = new AltCoinAddressValidator(new AssetRegistry());
BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
String currencyCode = baseCurrencyNetwork.getCurrencyCode();
Res.setBaseCurrencyCode(currencyCode);
Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());

View File

@ -45,7 +45,6 @@ import bisq.core.user.Preferences;
import bisq.common.UserThread;
import bisq.common.app.DevEnv;
import bisq.common.app.Log;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.setup.GracefulShutDownHandler;
import bisq.common.setup.UncaughtExceptionHandler;
@ -243,8 +242,8 @@ public class BisqApp extends Application implements UncaughtExceptionHandler {
// configure the primary stage
String appName = injector.getInstance(Key.get(String.class, Names.named(Config.APP_NAME)));
if (!BaseCurrencyNetwork.CURRENT_NETWORK.isMainnet())
appName += " [" + Res.get(BaseCurrencyNetwork.CURRENT_NETWORK.name()) + "]";
if (!Config.baseCurrencyNetwork().isMainnet())
appName += " [" + Res.get(Config.baseCurrencyNetwork().name()) + "]";
stage.setTitle(appName);
stage.setScene(scene);

View File

@ -89,7 +89,7 @@ import bisq.core.util.FormattingUtils;
import bisq.core.util.coin.CoinFormatter;
import bisq.core.util.validation.InputValidator;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.util.Tuple2;
import bisq.common.util.Tuple3;
@ -256,7 +256,7 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
.closeButtonText(Res.get("shared.cancel"))
.actionButtonText(Res.get("shared.iUnderstand"))
.onAction(() -> {
final String currencyName = BaseCurrencyNetwork.CURRENT_NETWORK.getCurrencyName();
final String currencyName = Config.baseCurrencyNetwork().getCurrencyName();
if (paymentAccount instanceof ClearXchangeAccount) {
new Popup().information(Res.get("payment.clearXchange.info", currencyName, currencyName))
.width(900)

View File

@ -51,7 +51,6 @@ import bisq.core.util.validation.IntegerValidator;
import bisq.common.UserThread;
import bisq.common.app.DevEnv;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.util.Tuple3;
import bisq.common.util.Utilities;
@ -273,7 +272,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
String estimatedFee = String.valueOf(feeService.getTxFeePerByte().value);
try {
int withdrawalTxFeePerByte = Integer.parseInt(transactionFeeInputTextField.getText());
final long minFeePerByte = BaseCurrencyNetwork.CURRENT_NETWORK.getDefaultMinFeePerByte();
final long minFeePerByte = Config.baseCurrencyNetwork().getDefaultMinFeePerByte();
if (withdrawalTxFeePerByte < minFeePerByte) {
new Popup().warning(Res.get("setting.preferences.txFeeMin", minFeePerByte)).show();
transactionFeeInputTextField.setText(estimatedFee);

View File

@ -58,7 +58,7 @@ import bisq.network.p2p.P2PService;
import bisq.common.UserThread;
import bisq.common.app.DevEnv;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.common.proto.persistable.PersistableList;
import bisq.common.proto.persistable.PersistenceProtoResolver;
import bisq.common.storage.CorruptedDatabaseFilesHandler;
@ -692,7 +692,7 @@ public class GUIUtil {
public static void showClearXchangeWarning() {
String key = "confirmClearXchangeRequirements";
final String currencyName = BaseCurrencyNetwork.CURRENT_NETWORK.getCurrencyName();
final String currencyName = Config.baseCurrencyNetwork().getCurrencyName();
new Popup().information(Res.get("payment.clearXchange.info", currencyName, currencyName))
.width(900)
.closeButtonText(Res.get("shared.iConfirm"))
@ -702,7 +702,7 @@ public class GUIUtil {
public static String getBitcoinURI(String address, Coin amount, String label) {
return address != null ?
BitcoinURI.convertToBitcoinURI(Address.fromBase58(BaseCurrencyNetwork.CURRENT_PARAMETERS,
BitcoinURI.convertToBitcoinURI(Address.fromBase58(Config.baseCurrencyNetworkParameters(),
address), amount, label, null) :
"";
}

View File

@ -26,7 +26,7 @@ import bisq.core.provider.price.PriceFeedService;
import bisq.core.util.coin.CoinFormatter;
import bisq.core.util.coin.ImmutableCoinFormatter;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import javafx.beans.property.SimpleIntegerProperty;
@ -49,7 +49,7 @@ import static org.mockito.Mockito.when;
public class OfferBookChartViewModelTest {
private final CoinFormatter coinFormatter = new ImmutableCoinFormatter(BaseCurrencyNetwork.CURRENT_PARAMETERS.getMonetaryFormat());
private final CoinFormatter coinFormatter = new ImmutableCoinFormatter(Config.baseCurrencyNetworkParameters().getMonetaryFormat());
@Before
public void setUp() {

View File

@ -26,7 +26,7 @@ import bisq.core.provider.price.PriceFeedService;
import bisq.core.util.coin.CoinFormatter;
import bisq.core.util.coin.ImmutableCoinFormatter;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@ -44,7 +44,7 @@ import static org.mockito.Mockito.when;
public class SpreadViewModelTest {
private final CoinFormatter coinFormatter = new ImmutableCoinFormatter(BaseCurrencyNetwork.CURRENT_PARAMETERS.getMonetaryFormat());
private final CoinFormatter coinFormatter = new ImmutableCoinFormatter(Config.baseCurrencyNetworkParameters().getMonetaryFormat());
@Test
public void testMaxCharactersForAmountWithNoOffers() {

View File

@ -44,7 +44,7 @@ import bisq.core.util.coin.BsqFormatter;
import bisq.core.util.coin.CoinFormatter;
import bisq.core.util.validation.InputValidator;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.bitcoinj.core.Coin;
@ -71,7 +71,7 @@ import static org.mockito.Mockito.when;
public class CreateOfferViewModelTest {
private CreateOfferViewModel model;
private final CoinFormatter coinFormatter = new ImmutableCoinFormatter(BaseCurrencyNetwork.CURRENT_PARAMETERS.getMonetaryFormat());
private final CoinFormatter coinFormatter = new ImmutableCoinFormatter(Config.baseCurrencyNetworkParameters().getMonetaryFormat());
@Before
public void setUp() {

View File

@ -45,7 +45,7 @@ import bisq.core.util.coin.CoinFormatter;
import bisq.core.util.coin.ImmutableCoinFormatter;
import bisq.core.util.coin.BsqFormatter;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import javafx.beans.property.SimpleIntegerProperty;
@ -81,7 +81,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class OfferBookViewModelTest {
private final CoinFormatter coinFormatter = new ImmutableCoinFormatter(BaseCurrencyNetwork.CURRENT_PARAMETERS.getMonetaryFormat());
private final CoinFormatter coinFormatter = new ImmutableCoinFormatter(Config.baseCurrencyNetworkParameters().getMonetaryFormat());
private static final Logger log = LoggerFactory.getLogger(OfferBookViewModelTest.class);
@Before

View File

@ -7,7 +7,7 @@ import bisq.core.offer.OfferPayload;
import bisq.core.util.coin.ImmutableCoinFormatter;
import bisq.core.util.coin.CoinFormatter;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.bitcoinj.core.Coin;
@ -27,7 +27,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class DisplayUtilsTest {
private final CoinFormatter formatter = new ImmutableCoinFormatter(BaseCurrencyNetwork.CURRENT_PARAMETERS.getMonetaryFormat());
private final CoinFormatter formatter = new ImmutableCoinFormatter(Config.baseCurrencyNetworkParameters().getMonetaryFormat());
@Before
public void setUp() {

View File

@ -21,7 +21,7 @@ import bisq.core.locale.Res;
import bisq.core.util.coin.ImmutableCoinFormatter;
import bisq.core.util.coin.CoinFormatter;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.bitcoinj.core.CoinMaker;
@ -41,7 +41,7 @@ import static org.mockito.Mockito.mock;
public class ImmutableCoinFormatterTest {
private final CoinFormatter formatter = new ImmutableCoinFormatter(BaseCurrencyNetwork.CURRENT_PARAMETERS.getMonetaryFormat());
private final CoinFormatter formatter = new ImmutableCoinFormatter(Config.baseCurrencyNetworkParameters().getMonetaryFormat());
@Before
public void setUp() {

View File

@ -4,6 +4,7 @@ import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.Res;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.junit.Before;
import org.junit.Test;
@ -14,7 +15,7 @@ import static org.junit.Assert.assertTrue;
public class AdvancedCashValidatorTest {
@Before
public void setup() {
final BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
final BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
final String currencyCode = baseCurrencyNetwork.getCurrencyCode();
Res.setBaseCurrencyCode(currencyCode);
Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());

View File

@ -18,6 +18,8 @@
package bisq.desktop.util.validation;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.Res;
import bisq.core.util.coin.CoinFormatter;
@ -33,11 +35,11 @@ import static org.junit.Assert.assertTrue;
public class BtcValidatorTest {
private final CoinFormatter coinFormatter = new ImmutableCoinFormatter(BaseCurrencyNetwork.CURRENT_PARAMETERS.getMonetaryFormat());
private final CoinFormatter coinFormatter = new ImmutableCoinFormatter(Config.baseCurrencyNetworkParameters().getMonetaryFormat());
@Before
public void setup() {
final BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
final BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
final String currencyCode = baseCurrencyNetwork.getCurrencyCode();
Res.setBaseCurrencyCode(currencyCode);
Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());

View File

@ -21,6 +21,7 @@ import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.Res;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.junit.Before;
import org.junit.Test;
@ -32,7 +33,7 @@ public class FiatVolumeValidatorTest {
@Before
public void setup() {
final BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
final BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
final String currencyCode = baseCurrencyNetwork.getCurrencyCode();
Res.setBaseCurrencyCode(currencyCode);
Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());

View File

@ -21,6 +21,7 @@ import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.Res;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.junit.Before;
import org.junit.Test;
@ -32,7 +33,7 @@ public class InteracETransferAnswerValidatorTest {
@Before
public void setup() {
final BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
final BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
final String currencyCode = baseCurrencyNetwork.getCurrencyCode();
Res.setBaseCurrencyCode(currencyCode);
Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());

View File

@ -21,6 +21,7 @@ import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.Res;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.junit.Before;
import org.junit.Test;
@ -32,7 +33,7 @@ public class InteracETransferQuestionValidatorTest {
@Before
public void setup() {
final BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
final BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
final String currencyCode = baseCurrencyNetwork.getCurrencyCode();
Res.setBaseCurrencyCode(currencyCode);
Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());

View File

@ -21,6 +21,7 @@ import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.Res;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.junit.Before;
import org.junit.Test;
@ -32,7 +33,7 @@ public class InteracETransferValidatorTest {
@Before
public void setup() {
final BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
final BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
final String currencyCode = baseCurrencyNetwork.getCurrencyCode();
Res.setBaseCurrencyCode(currencyCode);
Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());

View File

@ -21,6 +21,7 @@ import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.Res;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.junit.Before;
import org.junit.Test;
@ -32,7 +33,7 @@ public class LengthValidatorTest {
@Before
public void setup() {
final BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
final BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
final String currencyCode = baseCurrencyNetwork.getCurrencyCode();
Res.setBaseCurrencyCode(currencyCode);
Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());

View File

@ -21,6 +21,7 @@ import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.Res;
import bisq.common.config.BaseCurrencyNetwork;
import bisq.common.config.Config;
import org.junit.Before;
import org.junit.Test;
@ -32,7 +33,7 @@ public class RegexValidatorTest {
@Before
public void setup() {
final BaseCurrencyNetwork baseCurrencyNetwork = BaseCurrencyNetwork.CURRENT_NETWORK;
final BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
final String currencyCode = baseCurrencyNetwork.getCurrencyCode();
Res.setBaseCurrencyCode(currencyCode);
Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());