mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-02-26 17:31:27 -05:00
support --xmrBlockchainPath startup flag for local Monero node
This commit is contained in:
parent
88b6bed93e
commit
b571b39790
@ -118,6 +118,7 @@ public class Config {
|
|||||||
public static final String BYPASS_MEMPOOL_VALIDATION = "bypassMempoolValidation";
|
public static final String BYPASS_MEMPOOL_VALIDATION = "bypassMempoolValidation";
|
||||||
public static final String PASSWORD_REQUIRED = "passwordRequired";
|
public static final String PASSWORD_REQUIRED = "passwordRequired";
|
||||||
public static final String UPDATE_XMR_BINARIES = "updateXmrBinaries";
|
public static final String UPDATE_XMR_BINARIES = "updateXmrBinaries";
|
||||||
|
public static final String XMR_BLOCKCHAIN_PATH = "xmrBlockchainPath";
|
||||||
|
|
||||||
// Default values for certain options
|
// Default values for certain options
|
||||||
public static final int UNSPECIFIED_PORT = -1;
|
public static final int UNSPECIFIED_PORT = -1;
|
||||||
@ -206,6 +207,7 @@ public class Config {
|
|||||||
public final boolean bypassMempoolValidation;
|
public final boolean bypassMempoolValidation;
|
||||||
public final boolean passwordRequired;
|
public final boolean passwordRequired;
|
||||||
public final boolean updateXmrBinaries;
|
public final boolean updateXmrBinaries;
|
||||||
|
public final String xmrBlockchainPath;
|
||||||
|
|
||||||
// Properties derived from options but not exposed as options themselves
|
// Properties derived from options but not exposed as options themselves
|
||||||
public final File torDir;
|
public final File torDir;
|
||||||
@ -630,6 +632,13 @@ public class Config {
|
|||||||
.ofType(boolean.class)
|
.ofType(boolean.class)
|
||||||
.defaultsTo(true);
|
.defaultsTo(true);
|
||||||
|
|
||||||
|
ArgumentAcceptingOptionSpec<String> xmrBlockchainPathOpt =
|
||||||
|
parser.accepts(XMR_BLOCKCHAIN_PATH,
|
||||||
|
"Path to Monero blockchain when using local Monero node")
|
||||||
|
.withRequiredArg()
|
||||||
|
.ofType(String.class)
|
||||||
|
.defaultsTo("");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CompositeOptionSet options = new CompositeOptionSet();
|
CompositeOptionSet options = new CompositeOptionSet();
|
||||||
|
|
||||||
@ -743,6 +752,7 @@ public class Config {
|
|||||||
this.bypassMempoolValidation = options.valueOf(bypassMempoolValidationOpt);
|
this.bypassMempoolValidation = options.valueOf(bypassMempoolValidationOpt);
|
||||||
this.passwordRequired = options.valueOf(passwordRequiredOpt);
|
this.passwordRequired = options.valueOf(passwordRequiredOpt);
|
||||||
this.updateXmrBinaries = options.valueOf(updateXmrBinariesOpt);
|
this.updateXmrBinaries = options.valueOf(updateXmrBinariesOpt);
|
||||||
|
this.xmrBlockchainPath = options.valueOf(xmrBlockchainPathOpt);
|
||||||
} catch (OptionException ex) {
|
} catch (OptionException ex) {
|
||||||
throw new ConfigException("problem parsing option '%s': %s",
|
throw new ConfigException("problem parsing option '%s': %s",
|
||||||
ex.options().get(0),
|
ex.options().get(0),
|
||||||
@ -752,11 +762,11 @@ public class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create all appDataDir subdirectories and assign to their respective properties
|
// Create all appDataDir subdirectories and assign to their respective properties
|
||||||
File btcNetworkDir = mkdir(appDataDir, baseCurrencyNetwork.name().toLowerCase());
|
File xmrNetworkDir = mkdir(appDataDir, baseCurrencyNetwork.name().toLowerCase());
|
||||||
this.keyStorageDir = mkdir(btcNetworkDir, "keys");
|
this.keyStorageDir = mkdir(xmrNetworkDir, "keys");
|
||||||
this.storageDir = mkdir(btcNetworkDir, "db");
|
this.storageDir = mkdir(xmrNetworkDir, "db");
|
||||||
this.torDir = mkdir(btcNetworkDir, "tor");
|
this.torDir = mkdir(xmrNetworkDir, "tor");
|
||||||
this.walletDir = mkdir(btcNetworkDir, "wallet");
|
this.walletDir = mkdir(xmrNetworkDir, "wallet");
|
||||||
|
|
||||||
// Assign values to special-case static fields
|
// Assign values to special-case static fields
|
||||||
APP_DATA_DIR_VALUE = appDataDir;
|
APP_DATA_DIR_VALUE = appDataDir;
|
||||||
|
@ -166,11 +166,18 @@ public class XmrLocalNode {
|
|||||||
|
|
||||||
var args = new ArrayList<>(MONEROD_ARGS);
|
var args = new ArrayList<>(MONEROD_ARGS);
|
||||||
|
|
||||||
var dataDir = settings.getBlockchainPath();
|
var dataDir = "";
|
||||||
if (dataDir == null || dataDir.isEmpty()) {
|
if (config.xmrBlockchainPath == null || config.xmrBlockchainPath.isEmpty()) {
|
||||||
dataDir = MONEROD_DATADIR;
|
dataDir = settings.getBlockchainPath();
|
||||||
|
if (dataDir == null || dataDir.isEmpty()) {
|
||||||
|
dataDir = MONEROD_DATADIR;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dataDir = config.xmrBlockchainPath; // startup config overrides settings
|
||||||
|
}
|
||||||
|
if (dataDir != null && !dataDir.isEmpty()) {
|
||||||
|
args.add("--data-dir=" + dataDir);
|
||||||
}
|
}
|
||||||
if (dataDir != null) args.add("--data-dir=" + dataDir);
|
|
||||||
|
|
||||||
var bootstrapUrl = settings.getBootstrapUrl();
|
var bootstrapUrl = settings.getBootstrapUrl();
|
||||||
if (bootstrapUrl != null && !bootstrapUrl.isEmpty()) {
|
if (bootstrapUrl != null && !bootstrapUrl.isEmpty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user