From 3648c1eb0ed5f6d4e3912c3de4d1ba2ca576ee36 Mon Sep 17 00:00:00 2001 From: woodser <13068859+woodser@users.noreply.github.com> Date: Sun, 1 Jun 2025 15:15:35 -0400 Subject: [PATCH] skip polling if shut down started after acquiring lock --- .../main/java/haveno/core/trade/Trade.java | 3 +++ .../core/xmr/wallet/XmrWalletService.java | 21 +++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/haveno/core/trade/Trade.java b/core/src/main/java/haveno/core/trade/Trade.java index aa2330a7..29df35e4 100644 --- a/core/src/main/java/haveno/core/trade/Trade.java +++ b/core/src/main/java/haveno/core/trade/Trade.java @@ -2637,6 +2637,9 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model { // poll wallet try { + // skip if shut down started + if (isShutDownStarted) return; + // skip if payout unlocked if (isPayoutUnlocked()) return; 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 5a191068..26f300b7 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java @@ -1994,6 +1994,9 @@ public class XmrWalletService extends XmrWalletBase { // poll wallet try { + // skip if shut down started + if (isShutDownStarted) return; + // skip if daemon not synced MoneroDaemonInfo lastInfo = xmrConnectionService.getLastInfo(); if (lastInfo == null) { @@ -2059,16 +2062,16 @@ public class XmrWalletService extends XmrWalletBase { pollInProgress = false; } } + saveWalletWithDelay(); + } - // cache wallet info last - synchronized (walletLock) { - if (wallet != null && !isShutDownStarted) { - try { - cacheWalletInfo(); - saveWalletWithDelay(); - } catch (Exception e) { - log.warn("Error caching wallet info: " + e.getMessage() + "\n", e); - } + // cache wallet info last + synchronized (walletLock) { + if (wallet != null && !isShutDownStarted) { + try { + cacheWalletInfo(); + } catch (Exception e) { + log.warn("Error caching wallet info: " + e.getMessage() + "\n", e); } } }