diff --git a/common/src/main/java/bisq/common/config/Config.java b/common/src/main/java/bisq/common/config/Config.java index a88f1b0d25..283aec93f9 100644 --- a/common/src/main/java/bisq/common/config/Config.java +++ b/common/src/main/java/bisq/common/config/Config.java @@ -70,6 +70,7 @@ public class Config { public static final String RPC_PORT = "rpcPort"; public static final String RPC_BLOCK_NOTIFICATION_PORT = "rpcBlockNotificationPort"; public static final String RPC_BLOCK_NOTIFICATION_HOST = "rpcBlockNotificationHost"; + public static final String DUMP_BLOCKCHAIN_DATA = "dumpBlockchainData"; private static final Logger log = LoggerFactory.getLogger(Config.class); @@ -137,6 +138,7 @@ public class Config { private final int rpcPort; private final int rpcBlockNotificationPort; private final String rpcBlockNotificationHost; + private final boolean dumpBlockchainData; // properties derived from cli options, but not exposed as cli options themselves private boolean localBitcoinNodeIsRunning = false; // FIXME: eliminate mutable state @@ -485,6 +487,13 @@ public class Config { .withRequiredArg() .defaultsTo(""); + ArgumentAcceptingOptionSpec dumpBlockchainDataOpt = + parser.accepts(DUMP_BLOCKCHAIN_DATA, "If set to true the blockchain data " + + "from RPC requests to Bitcoin Core are stored as json file in the data dir.") + .withRequiredArg() + .ofType(boolean.class) + .defaultsTo(false); + try { OptionSet cliOpts = parser.parse(args); @@ -578,6 +587,7 @@ public class Config { this.rpcPort = options.valueOf(rpcPortOpt); this.rpcBlockNotificationPort = options.valueOf(rpcBlockNotificationPortOpt); this.rpcBlockNotificationHost = options.valueOf(rpcBlockNotificationHostOpt); + this.dumpBlockchainData = options.valueOf(dumpBlockchainDataOpt); } catch (OptionException ex) { throw new ConfigException(format("problem parsing option '%s': %s", ex.options().get(0), @@ -865,4 +875,8 @@ public class Config { public String getRpcBlockNotificationHost() { return rpcBlockNotificationHost; } + + public boolean isDumpBlockchainData() { + return dumpBlockchainData; + } } diff --git a/core/src/main/java/bisq/core/app/BisqEnvironment.java b/core/src/main/java/bisq/core/app/BisqEnvironment.java index 1534e4e899..292cd1b688 100644 --- a/core/src/main/java/bisq/core/app/BisqEnvironment.java +++ b/core/src/main/java/bisq/core/app/BisqEnvironment.java @@ -57,7 +57,7 @@ public class BisqEnvironment extends StandardEnvironment { protected boolean isBitcoinLocalhostNodeRunning; protected final String - dumpBlockchainData, fullDaoNode, + fullDaoNode, genesisTxId, genesisBlockHeight, genesisTotalSupply, daoActivated; @@ -69,7 +69,6 @@ public class BisqEnvironment extends StandardEnvironment { @SuppressWarnings("ConstantConditions") public BisqEnvironment(PropertySource commandLineProperties) { //DaoOptionKeys - dumpBlockchainData = getProperty(commandLineProperties, DaoOptionKeys.DUMP_BLOCKCHAIN_DATA, ""); fullDaoNode = getProperty(commandLineProperties, DaoOptionKeys.FULL_DAO_NODE, ""); genesisTxId = getProperty(commandLineProperties, DaoOptionKeys.GENESIS_TX_ID, ""); genesisBlockHeight = getProperty(commandLineProperties, DaoOptionKeys.GENESIS_BLOCK_HEIGHT, "-1"); @@ -92,7 +91,6 @@ public class BisqEnvironment extends StandardEnvironment { private PropertySource defaultProperties() { return new PropertiesPropertySource(BISQ_DEFAULT_PROPERTY_SOURCE_NAME, new Properties() { { - setProperty(DaoOptionKeys.DUMP_BLOCKCHAIN_DATA, dumpBlockchainData); setProperty(DaoOptionKeys.FULL_DAO_NODE, fullDaoNode); setProperty(DaoOptionKeys.GENESIS_TX_ID, genesisTxId); setProperty(DaoOptionKeys.GENESIS_BLOCK_HEIGHT, genesisBlockHeight); diff --git a/core/src/main/java/bisq/core/app/BisqExecutable.java b/core/src/main/java/bisq/core/app/BisqExecutable.java index 404622ecab..c179e2cffb 100644 --- a/core/src/main/java/bisq/core/app/BisqExecutable.java +++ b/core/src/main/java/bisq/core/app/BisqExecutable.java @@ -285,12 +285,6 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet .ofType(boolean.class); //RpcOptionKeys - parser.accepts(DaoOptionKeys.DUMP_BLOCKCHAIN_DATA, - format("If set to true the blockchain data from RPC requests to Bitcoin Core are " + - "stored as json file in the data dir. (default: %s)", "false")) - .withRequiredArg() - .ofType(boolean.class); - parser.accepts(DaoOptionKeys.FULL_DAO_NODE, "If set to true the node requests the blockchain data via RPC requests " + "from Bitcoin Core and provide the validated BSQ txs to the network. " + diff --git a/core/src/main/java/bisq/core/dao/DaoModule.java b/core/src/main/java/bisq/core/dao/DaoModule.java index 7be54e86a0..264e13b416 100644 --- a/core/src/main/java/bisq/core/dao/DaoModule.java +++ b/core/src/main/java/bisq/core/dao/DaoModule.java @@ -229,8 +229,7 @@ public class DaoModule extends AppModule { bindConstant().annotatedWith(named(Config.RPC_PORT)).to(config.getRpcPort()); bindConstant().annotatedWith(named(Config.RPC_BLOCK_NOTIFICATION_PORT)).to(config.getRpcBlockNotificationPort()); bindConstant().annotatedWith(named(Config.RPC_BLOCK_NOTIFICATION_HOST)).to(config.getRpcBlockNotificationHost()); - bindConstant().annotatedWith(named(DaoOptionKeys.DUMP_BLOCKCHAIN_DATA)) - .to(environment.getRequiredProperty(DaoOptionKeys.DUMP_BLOCKCHAIN_DATA)); + bindConstant().annotatedWith(named(Config.DUMP_BLOCKCHAIN_DATA)).to(config.isDumpBlockchainData()); bindConstant().annotatedWith(named(DaoOptionKeys.FULL_DAO_NODE)) .to(environment.getRequiredProperty(DaoOptionKeys.FULL_DAO_NODE)); diff --git a/core/src/main/java/bisq/core/dao/DaoOptionKeys.java b/core/src/main/java/bisq/core/dao/DaoOptionKeys.java index 5a13469287..f469a1ac93 100644 --- a/core/src/main/java/bisq/core/dao/DaoOptionKeys.java +++ b/core/src/main/java/bisq/core/dao/DaoOptionKeys.java @@ -22,7 +22,6 @@ package bisq.core.dao; */ public class DaoOptionKeys { - public static final String DUMP_BLOCKCHAIN_DATA = "dumpBlockchainData"; public static final String FULL_DAO_NODE = "fullDaoNode"; public static final String GENESIS_TX_ID = "genesisTxId"; public static final String GENESIS_BLOCK_HEIGHT = "genesisBlockHeight"; diff --git a/core/src/main/java/bisq/core/dao/node/explorer/ExportJsonFilesService.java b/core/src/main/java/bisq/core/dao/node/explorer/ExportJsonFilesService.java index c244dc5664..7a2711c769 100644 --- a/core/src/main/java/bisq/core/dao/node/explorer/ExportJsonFilesService.java +++ b/core/src/main/java/bisq/core/dao/node/explorer/ExportJsonFilesService.java @@ -17,7 +17,6 @@ package bisq.core.dao.node.explorer; -import bisq.core.dao.DaoOptionKeys; import bisq.core.dao.DaoSetupService; import bisq.core.dao.state.DaoStateService; import bisq.core.dao.state.model.DaoState; @@ -71,7 +70,7 @@ public class ExportJsonFilesService implements DaoSetupService { @Inject public ExportJsonFilesService(DaoStateService daoStateService, @Named(Config.STORAGE_DIR) File storageDir, - @Named(DaoOptionKeys.DUMP_BLOCKCHAIN_DATA) boolean dumpBlockchainData) { + @Named(Config.DUMP_BLOCKCHAIN_DATA) boolean dumpBlockchainData) { this.daoStateService = daoStateService; this.storageDir = storageDir; this.dumpBlockchainData = dumpBlockchainData;