From 4b7307e07fbb687e989414ddd38f72f3901f1bab Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Tue, 22 Sep 2020 19:35:01 -0500 Subject: [PATCH] Add checks for state at handle CounterCurrencyTransferStartedMessage Add ApplyFilter task --- .../core/trade/protocol/SellerAsMakerProtocol.java | 14 ++++++++++++++ .../core/trade/protocol/SellerAsTakerProtocol.java | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/core/src/main/java/bisq/core/trade/protocol/SellerAsMakerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/SellerAsMakerProtocol.java index 54d902fce9..a9f3bb29aa 100644 --- a/core/src/main/java/bisq/core/trade/protocol/SellerAsMakerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/SellerAsMakerProtocol.java @@ -174,6 +174,19 @@ public class SellerAsMakerProtocol extends TradeProtocol implements SellerProtoc /////////////////////////////////////////////////////////////////////////////////////////// private void handle(CounterCurrencyTransferStartedMessage tradeMessage, NodeAddress sender) { + if (trade.getPayoutTx() != null) { + log.warn("We received a CounterCurrencyTransferStartedMessage but we have already created the payout tx " + + "so we ignore the message. This can happen if the ACK message to the peer did not " + + "arrive and the peer repeats sending us the message. We send another ACK msg."); + sendAckMessage(tradeMessage, true, null); + processModel.removeMailboxMessageAfterProcessing(trade); + return; + } + + if (!isTradeInPhase(Trade.Phase.DEPOSIT_CONFIRMED, tradeMessage)) { + return; + } + processModel.setTradeMessage(tradeMessage); processModel.setTempTradingPeerNodeAddress(sender); @@ -184,6 +197,7 @@ public class SellerAsMakerProtocol extends TradeProtocol implements SellerProtoc taskRunner.addTasks( SellerProcessCounterCurrencyTransferStartedMessage.class, MakerVerifyTakerAccount.class, + ApplyFilter.class, MakerVerifyTakerFeePayment.class ); taskRunner.run(); diff --git a/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java index 7d4f6f1e3b..900fa6e6b8 100644 --- a/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java @@ -173,6 +173,19 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc /////////////////////////////////////////////////////////////////////////////////////////// private void handle(CounterCurrencyTransferStartedMessage tradeMessage, NodeAddress sender) { + if (trade.getPayoutTx() != null) { + log.warn("We received a CounterCurrencyTransferStartedMessage but we have already created the payout tx " + + "so we ignore the message. This can happen if the ACK message to the peer did not " + + "arrive and the peer repeats sending us the message. We send another ACK msg."); + sendAckMessage(tradeMessage, true, null); + processModel.removeMailboxMessageAfterProcessing(trade); + return; + } + + if (!isTradeInPhase(Trade.Phase.DEPOSIT_CONFIRMED, tradeMessage)) { + return; + } + processModel.setTradeMessage(tradeMessage); processModel.setTempTradingPeerNodeAddress(sender); @@ -183,6 +196,7 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc taskRunner.addTasks( SellerProcessCounterCurrencyTransferStartedMessage.class, TakerVerifyMakerAccount.class, + ApplyFilter.class, TakerVerifyMakerFeePayment.class ); taskRunner.run();