diff --git a/core/src/main/java/haveno/core/trade/Trade.java b/core/src/main/java/haveno/core/trade/Trade.java index 994c6112..dbab49cd 100644 --- a/core/src/main/java/haveno/core/trade/Trade.java +++ b/core/src/main/java/haveno/core/trade/Trade.java @@ -2500,10 +2500,18 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model { } private void doPollWallet() { + + // skip if shut down started if (isShutDownStarted) return; + + // set poll in progress + boolean pollInProgressSet = false; synchronized (pollLock) { + if (!pollInProgress) pollInProgressSet = true; pollInProgress = true; } + + // poll wallet try { // skip if payout unlocked @@ -2628,8 +2636,10 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model { } } } finally { - synchronized (pollLock) { - pollInProgress = false; + if (pollInProgressSet) { + synchronized (pollLock) { + pollInProgress = false; + } } requestSaveWallet(); } 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 1a9ead35..6ffd6537 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java @@ -1837,10 +1837,18 @@ public class XmrWalletService extends XmrWalletBase { } private void doPollWallet(boolean updateTxs) { + + // skip if shut down started + if (isShutDownStarted) return; + + // set poll in progress + boolean pollInProgressSet = false; synchronized (pollLock) { + if (!pollInProgress) pollInProgressSet = true; pollInProgress = true; } - if (isShutDownStarted) return; + + // poll wallet try { // skip if daemon not synced @@ -1903,8 +1911,10 @@ public class XmrWalletService extends XmrWalletBase { //e.printStackTrace(); } } finally { - synchronized (pollLock) { - pollInProgress = false; + if (pollInProgressSet) { + synchronized (pollLock) { + pollInProgress = false; + } } // cache wallet info last