diff --git a/core/src/main/java/haveno/core/user/PreferencesPayload.java b/core/src/main/java/haveno/core/user/PreferencesPayload.java index f82034b5..d40cc1f4 100644 --- a/core/src/main/java/haveno/core/user/PreferencesPayload.java +++ b/core/src/main/java/haveno/core/user/PreferencesPayload.java @@ -131,7 +131,7 @@ public final class PreferencesPayload implements PersistableEnvelope { private boolean denyApiTaker; private boolean notifyOnPreRelease; - private MoneroNodeSettings moneroNodeSettings; + private MoneroNodeSettings moneroNodeSettings = new MoneroNodeSettings(); /////////////////////////////////////////////////////////////////////////////////////////// // Constructor diff --git a/core/src/main/java/haveno/core/xmr/MoneroNodeSettings.java b/core/src/main/java/haveno/core/xmr/MoneroNodeSettings.java index fa8fe1ec..43fe7856 100644 --- a/core/src/main/java/haveno/core/xmr/MoneroNodeSettings.java +++ b/core/src/main/java/haveno/core/xmr/MoneroNodeSettings.java @@ -20,18 +20,25 @@ import haveno.common.proto.persistable.PersistableEnvelope; import lombok.AllArgsConstructor; import lombok.Data; import lombok.extern.slf4j.Slf4j; - import java.util.List; +import java.util.Optional; +import javax.annotation.Nullable; @Slf4j @Data @AllArgsConstructor public class MoneroNodeSettings implements PersistableEnvelope { + @Nullable String blockchainPath; + @Nullable String bootstrapUrl; + @Nullable List startupFlags; + public MoneroNodeSettings() { + } + public static MoneroNodeSettings fromProto(protobuf.MoneroNodeSettings proto) { return new MoneroNodeSettings( proto.getBlockchainPath(), @@ -41,9 +48,10 @@ public class MoneroNodeSettings implements PersistableEnvelope { @Override public protobuf.MoneroNodeSettings toProtoMessage() { - return protobuf.MoneroNodeSettings.newBuilder() - .setBlockchainPath(blockchainPath) - .setBootstrapUrl(bootstrapUrl) - .addAllStartupFlags(startupFlags).build(); + protobuf.MoneroNodeSettings.Builder builder = protobuf.MoneroNodeSettings.newBuilder(); + Optional.ofNullable(blockchainPath).ifPresent(e -> builder.setBlockchainPath(blockchainPath)); + Optional.ofNullable(bootstrapUrl).ifPresent(e -> builder.setBlockchainPath(bootstrapUrl)); + Optional.ofNullable(startupFlags).ifPresent(e -> builder.addAllStartupFlags(startupFlags)); + return builder.build(); } }