From 2e57e6197de4f9e42ba6764199d759cdf376fa19 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 1 Aug 2024 09:41:34 -0400 Subject: [PATCH] release lock processing offers before callback --- .../java/haveno/core/offer/OpenOfferManager.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/haveno/core/offer/OpenOfferManager.java b/core/src/main/java/haveno/core/offer/OpenOfferManager.java index 5b2bfba6e6..282249d425 100644 --- a/core/src/main/java/haveno/core/offer/OpenOfferManager.java +++ b/core/src/main/java/haveno/core/offer/OpenOfferManager.java @@ -863,8 +863,8 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe TransactionResultHandler resultHandler, // TODO (woodser): transaction not needed with result handler ErrorMessageHandler errorMessageHandler) { ThreadUtils.execute(() -> { + List errorMessages = new ArrayList(); synchronized (processOffersLock) { - List errorMessages = new ArrayList(); List openOffers = getOpenOffers(); for (OpenOffer pendingOffer : openOffers) { if (pendingOffer.getState() != OpenOffer.State.PENDING) continue; @@ -887,12 +887,12 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe }); HavenoUtils.awaitLatch(latch); } - requestPersistence(); - if (errorMessages.isEmpty()) { - if (resultHandler != null) resultHandler.handleResult(null); - } else { - if (errorMessageHandler != null) errorMessageHandler.handleErrorMessage(errorMessages.toString()); - } + } + requestPersistence(); + if (errorMessages.isEmpty()) { + if (resultHandler != null) resultHandler.handleResult(null); + } else { + if (errorMessageHandler != null) errorMessageHandler.handleErrorMessage(errorMessages.toString()); } }, THREAD_ID); }