From 6dc9842253f92b1fa14b2e4a9e3c4fc25f2cd0fd Mon Sep 17 00:00:00 2001 From: woodser Date: Sun, 21 Jan 2024 07:59:40 -0500 Subject: [PATCH] open dispute on trade thread --- .../src/main/java/haveno/core/api/CoreDisputesService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/haveno/core/api/CoreDisputesService.java b/core/src/main/java/haveno/core/api/CoreDisputesService.java index 20c4ae48..2fd20e90 100644 --- a/core/src/main/java/haveno/core/api/CoreDisputesService.java +++ b/core/src/main/java/haveno/core/api/CoreDisputesService.java @@ -1,6 +1,8 @@ package haveno.core.api; import com.google.inject.name.Named; + +import haveno.common.ThreadUtils; import haveno.common.crypto.KeyRing; import haveno.common.crypto.PubKeyRing; import haveno.common.handlers.FaultHandler; @@ -81,7 +83,8 @@ public class CoreDisputesService { Trade trade = tradeManager.getOpenTrade(tradeId).orElseThrow(() -> new IllegalArgumentException(format("trade with id '%s' not found", tradeId))); - synchronized (trade) { + // open dispute on trade thread + ThreadUtils.execute(() -> { Offer offer = trade.getOffer(); if (offer == null) throw new IllegalStateException(format("offer with tradeId '%s' is null", tradeId)); @@ -96,7 +99,7 @@ public class CoreDisputesService { // one for the opener, the other for the peer, see sendPeerOpenedDisputeMessage. disputeManager.sendDisputeOpenedMessage(dispute, false, trade.getSelf().getUpdatedMultisigHex(), resultHandler, faultHandler); tradeManager.requestPersistence(); - } + }, trade.getId()); } public Dispute createDisputeForTrade(Trade trade, Offer offer, PubKeyRing pubKey, boolean isMaker, boolean isSupportTicket) {