mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 15:00:30 +01:00
Move 'dumpBlockchainData' option handling to Config
This commit is contained in:
parent
9a7eedb250
commit
2995bc27bd
6 changed files with 17 additions and 14 deletions
|
@ -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<Boolean> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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. " +
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue