mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-12 00:20:08 -04:00
Merge branch 'haveno-dex:master' into haveno-reto
This commit is contained in:
commit
45ecad8303
3 changed files with 33 additions and 10 deletions
|
@ -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()) {
|
||||||
|
|
|
@ -378,6 +378,7 @@ public abstract class PaymentAccount implements PersistablePayload {
|
||||||
@NonNull
|
@NonNull
|
||||||
public abstract List<PaymentAccountFormField.FieldId> getInputFieldIds();
|
public abstract List<PaymentAccountFormField.FieldId> getInputFieldIds();
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public PaymentAccountForm toForm() {
|
public PaymentAccountForm toForm() {
|
||||||
|
|
||||||
// convert to json map
|
// convert to json map
|
||||||
|
@ -387,7 +388,12 @@ public abstract class PaymentAccount implements PersistablePayload {
|
||||||
PaymentAccountForm form = new PaymentAccountForm(PaymentAccountForm.FormId.valueOf(paymentMethod.getId()));
|
PaymentAccountForm form = new PaymentAccountForm(PaymentAccountForm.FormId.valueOf(paymentMethod.getId()));
|
||||||
for (PaymentAccountFormField.FieldId fieldId : getInputFieldIds()) {
|
for (PaymentAccountFormField.FieldId fieldId : getInputFieldIds()) {
|
||||||
PaymentAccountFormField field = getEmptyFormField(fieldId);
|
PaymentAccountFormField field = getEmptyFormField(fieldId);
|
||||||
field.setValue((String) jsonMap.get(HavenoUtils.toCamelCase(field.getId().toString())));
|
Object value = jsonMap.get(HavenoUtils.toCamelCase(field.getId().toString()));
|
||||||
|
if (value instanceof List) { // TODO: list should already be serialized to comma delimited string in PaymentAccount.toJson() (PaymentAccountTypeAdapter?)
|
||||||
|
field.setValue(String.join(",", (List<String>) value));
|
||||||
|
} else {
|
||||||
|
field.setValue((String) value);
|
||||||
|
}
|
||||||
form.getFields().add(field);
|
form.getFields().add(field);
|
||||||
}
|
}
|
||||||
return form;
|
return form;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue