From 83352ec1e38b1b2d43e75b5cc6a8f5ea8f94557f Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 16 Nov 2023 09:02:38 -0500 Subject: [PATCH] set or clear connection error message on each daemon poll --- .../core/api/CoreMoneroConnectionsService.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java b/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java index e316901ea7..38109c345f 100644 --- a/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java +++ b/core/src/main/java/haveno/core/api/CoreMoneroConnectionsService.java @@ -566,13 +566,17 @@ public final class CoreMoneroConnectionsService { if (lastErrorTimestamp != null) { log.info("Successfully fetched daemon info after previous error"); lastErrorTimestamp = null; - if (HavenoUtils.havenoSetup != null) HavenoUtils.havenoSetup.getWalletServiceErrorMsg().set(null); } // update and notify connected state if (!Boolean.TRUE.equals(connectionManager.isConnected())) { connectionManager.checkConnection(); } + + // clear error message + if (Boolean.TRUE.equals(connectionManager.isConnected()) && HavenoUtils.havenoSetup != null) { + HavenoUtils.havenoSetup.getWalletServiceErrorMsg().set(null); + } } catch (Exception e) { // log error message periodically @@ -582,14 +586,16 @@ public final class CoreMoneroConnectionsService { if (DevEnv.isDevMode()) e.printStackTrace(); } - // notify error message - if (HavenoUtils.havenoSetup != null) HavenoUtils.havenoSetup.getWalletServiceErrorMsg().set(e.getMessage()); - // check connection which notifies of changes synchronized (this) { if (connectionManager.getAutoSwitch()) connectionManager.setConnection(connectionManager.getBestAvailableConnection()); else connectionManager.checkConnection(); } + + // set error message + if (!Boolean.TRUE.equals(connectionManager.isConnected()) && HavenoUtils.havenoSetup != null) { + HavenoUtils.havenoSetup.getWalletServiceErrorMsg().set(e.getMessage()); + } } }