diff --git a/core/src/main/java/haveno/core/api/XmrConnectionService.java b/core/src/main/java/haveno/core/api/XmrConnectionService.java index d676edd0db..0cc66c7475 100644 --- a/core/src/main/java/haveno/core/api/XmrConnectionService.java +++ b/core/src/main/java/haveno/core/api/XmrConnectionService.java @@ -519,7 +519,7 @@ public final class XmrConnectionService { private void maybeStartLocalNode() { // skip if seed node - if (HavenoUtils.havenoSetup == null) return; + if (HavenoUtils.isSeedNode()) return; // start local node if offline and used as last connection if (connectionManager.getConnection() != null && xmrLocalNode.equalsUri(connectionManager.getConnection().getUri()) && !xmrLocalNode.isDetected() && !xmrLocalNode.shouldBeIgnored()) { diff --git a/core/src/main/java/haveno/core/offer/OfferBookService.java b/core/src/main/java/haveno/core/offer/OfferBookService.java index 5492c35532..8b7f501886 100644 --- a/core/src/main/java/haveno/core/offer/OfferBookService.java +++ b/core/src/main/java/haveno/core/offer/OfferBookService.java @@ -121,21 +121,21 @@ public class OfferBookService { @Override public void onRemoved(Collection protectedStorageEntries) { - protectedStorageEntries.forEach(protectedStorageEntry -> { - synchronized (offerBookChangedListeners) { - offerBookChangedListeners.forEach(listener -> { - if (protectedStorageEntry.getProtectedStoragePayload() instanceof OfferPayload) { - OfferPayload offerPayload = (OfferPayload) protectedStorageEntry.getProtectedStoragePayload(); - maybeInitializeKeyImagePoller(); - keyImagePoller.removeKeyImages(offerPayload.getReserveTxKeyImages()); - Offer offer = new Offer(offerPayload); - offer.setPriceFeedService(priceFeedService); - setReservedFundsSpent(offer); - listener.onRemoved(offer); - } - }); - } - }); + protectedStorageEntries.forEach(protectedStorageEntry -> { + synchronized (offerBookChangedListeners) { + offerBookChangedListeners.forEach(listener -> { + if (protectedStorageEntry.getProtectedStoragePayload() instanceof OfferPayload) { + OfferPayload offerPayload = (OfferPayload) protectedStorageEntry.getProtectedStoragePayload(); + maybeInitializeKeyImagePoller(); + keyImagePoller.removeKeyImages(offerPayload.getReserveTxKeyImages()); + Offer offer = new Offer(offerPayload); + offer.setPriceFeedService(priceFeedService); + setReservedFundsSpent(offer); + listener.onRemoved(offer); + } + }); + } + }); } }); diff --git a/core/src/main/java/haveno/core/trade/HavenoUtils.java b/core/src/main/java/haveno/core/trade/HavenoUtils.java index 46134a9916..1b2fc24ac0 100644 --- a/core/src/main/java/haveno/core/trade/HavenoUtils.java +++ b/core/src/main/java/haveno/core/trade/HavenoUtils.java @@ -74,6 +74,10 @@ public class HavenoUtils { public static ArbitrationManager arbitrationManager; public static HavenoSetup havenoSetup; + public static boolean isSeedNode() { + return havenoSetup == null; + } + // ----------------------- CONVERSION UTILS ------------------------------- public static BigInteger coinToAtomicUnits(Coin coin) { diff --git a/core/src/main/java/haveno/core/trade/TradeManager.java b/core/src/main/java/haveno/core/trade/TradeManager.java index eaa610b325..fb35ca7809 100644 --- a/core/src/main/java/haveno/core/trade/TradeManager.java +++ b/core/src/main/java/haveno/core/trade/TradeManager.java @@ -428,7 +428,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi } // process after all wallets initialized - if (HavenoUtils.havenoSetup != null) { // null for seednode + if (!HavenoUtils.isSeedNode()) { // maybe remove trades on error for (Trade trade : tradesToMaybeRemoveOnError) {