From 5db80eac17eb4b19e4665afd4f3d9b1b371b24c8 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 12 Jan 2023 15:14:30 -0500 Subject: [PATCH] resend payment sent/received messages on startup if not arrived --- .../main/java/bisq/core/trade/protocol/BuyerProtocol.java | 5 ++--- .../main/java/bisq/core/trade/protocol/SellerProtocol.java | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/bisq/core/trade/protocol/BuyerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/BuyerProtocol.java index ff247489ec..6c5acfabf1 100644 --- a/core/src/main/java/bisq/core/trade/protocol/BuyerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/BuyerProtocol.java @@ -54,11 +54,10 @@ public class BuyerProtocol extends DisputeProtocol { super.onInitialized(); // re-send payment sent message if not arrived - if (trade.getState() == Trade.State.BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG || trade.getState() == Trade.State.BUYER_SEND_FAILED_PAYMENT_SENT_MSG) { - synchronized (trade) { + synchronized (trade) { + if (trade.getState().ordinal() >= Trade.State.BUYER_CONFIRMED_IN_UI_PAYMENT_SENT.ordinal() && trade.getState().ordinal() <= Trade.State.BUYER_SEND_FAILED_PAYMENT_SENT_MSG.ordinal()) { latchTrade(); given(anyPhase(Trade.Phase.PAYMENT_SENT) - .anyState(Trade.State.BUYER_STORED_IN_MAILBOX_PAYMENT_SENT_MSG, Trade.State.BUYER_SEND_FAILED_PAYMENT_SENT_MSG) .with(BuyerEvent.STARTUP)) .setup(tasks( BuyerSendPaymentSentMessageToSeller.class, diff --git a/core/src/main/java/bisq/core/trade/protocol/SellerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/SellerProtocol.java index 561a8a3225..f315c834bf 100644 --- a/core/src/main/java/bisq/core/trade/protocol/SellerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/SellerProtocol.java @@ -50,11 +50,10 @@ public class SellerProtocol extends DisputeProtocol { super.onInitialized(); // re-send payment received message if not arrived - if (trade.getState() == Trade.State.SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG || trade.getState() == Trade.State.SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG) { - synchronized (trade) { + synchronized (trade) { + if (trade.getState().ordinal() >= Trade.State.SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT.ordinal() && trade.getState().ordinal() <= Trade.State.SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG.ordinal()) { latchTrade(); given(anyPhase(Trade.Phase.PAYMENT_RECEIVED) - .anyState(Trade.State.SELLER_STORED_IN_MAILBOX_PAYMENT_RECEIVED_MSG, Trade.State.SELLER_SEND_FAILED_PAYMENT_RECEIVED_MSG) .with(SellerEvent.STARTUP)) .setup(tasks( SellerSendPaymentReceivedMessageToBuyer.class,