From 9cd28a6bde6df99cf5f87201c7f034cb67e1b8f0 Mon Sep 17 00:00:00 2001 From: woodser Date: Tue, 21 May 2024 12:22:55 -0400 Subject: [PATCH] fix connection to custom node on startup #945 --- .../main/java/haveno/core/api/XmrConnectionService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/haveno/core/api/XmrConnectionService.java b/core/src/main/java/haveno/core/api/XmrConnectionService.java index 48ba17b55f..579dfd4c3f 100644 --- a/core/src/main/java/haveno/core/api/XmrConnectionService.java +++ b/core/src/main/java/haveno/core/api/XmrConnectionService.java @@ -459,8 +459,11 @@ public final class XmrConnectionService { } // restore last connection - if (connectionList.getCurrentConnectionUri().isPresent() && connectionManager.hasConnection(connectionList.getCurrentConnectionUri().get())) { - if (!HavenoUtils.isLocalHost(connectionList.getCurrentConnectionUri().get()) || !xmrLocalNode.shouldBeIgnored()) { + if (isFixedConnection()) { + if (getConnections().size() != 1) throw new IllegalStateException("Expected connection list to have 1 fixed connection but was: " + getConnections().size()); + connectionManager.setConnection(getConnections().get(0)); + } else if (connectionList.getCurrentConnectionUri().isPresent() && connectionManager.hasConnection(connectionList.getCurrentConnectionUri().get())) { + if (!xmrLocalNode.shouldBeIgnored() || !xmrLocalNode.equalsUri(connectionList.getCurrentConnectionUri().get())) { connectionManager.setConnection(connectionList.getCurrentConnectionUri().get()); } }