From 43bbb2938492e1e74076d9cf375f1e4fc71c6dae Mon Sep 17 00:00:00 2001 From: woodser Date: Mon, 1 Jan 2024 21:06:33 -0500 Subject: [PATCH] try syncing main wallet when height > target height on startup --- .../java/haveno/core/xmr/wallet/XmrWalletService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java index 60cf520a..0311c88b 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java @@ -841,7 +841,11 @@ public class XmrWalletService { if (wallet.getHeight() < xmrConnectionService.getTargetHeight()) updateSyncProgress(); else { syncLooper.stop(); - syncWallet(); // necessary to fully sync + try { + syncWallet(); // ensure finished syncing + } catch (Exception e) { + e.printStackTrace(); + } wasWalletSynced = true; updateSyncProgress(); latch.countDown(); @@ -990,9 +994,10 @@ public class XmrWalletService { if (connection != null) { wallet.getDaemonConnection().setPrintStackTrace(PRINT_STACK_TRACE); HavenoUtils.submitToPool(() -> { + if (isShutDownStarted) return; + wallet.startSyncing(xmrConnectionService.getRefreshPeriodMs()); try { if (Boolean.TRUE.equals(connection.isConnected())) syncWallet(); - wallet.startSyncing(xmrConnectionService.getRefreshPeriodMs()); } catch (Exception e) { log.warn("Failed to sync main wallet after setting daemon connection: " + e.getMessage()); }