Add checks for state at handle CounterCurrencyTransferStartedMessage

Add ApplyFilter task
This commit is contained in:
chimp1984 2020-09-22 19:35:01 -05:00
parent c7e0c51875
commit 4b7307e07f
No known key found for this signature in database
GPG key ID: 9801B4EC591F90E3
2 changed files with 28 additions and 0 deletions

View file

@ -174,6 +174,19 @@ public class SellerAsMakerProtocol extends TradeProtocol implements SellerProtoc
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private void handle(CounterCurrencyTransferStartedMessage tradeMessage, NodeAddress sender) { 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.setTradeMessage(tradeMessage);
processModel.setTempTradingPeerNodeAddress(sender); processModel.setTempTradingPeerNodeAddress(sender);
@ -184,6 +197,7 @@ public class SellerAsMakerProtocol extends TradeProtocol implements SellerProtoc
taskRunner.addTasks( taskRunner.addTasks(
SellerProcessCounterCurrencyTransferStartedMessage.class, SellerProcessCounterCurrencyTransferStartedMessage.class,
MakerVerifyTakerAccount.class, MakerVerifyTakerAccount.class,
ApplyFilter.class,
MakerVerifyTakerFeePayment.class MakerVerifyTakerFeePayment.class
); );
taskRunner.run(); taskRunner.run();

View file

@ -173,6 +173,19 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private void handle(CounterCurrencyTransferStartedMessage tradeMessage, NodeAddress sender) { 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.setTradeMessage(tradeMessage);
processModel.setTempTradingPeerNodeAddress(sender); processModel.setTempTradingPeerNodeAddress(sender);
@ -183,6 +196,7 @@ public class SellerAsTakerProtocol extends TradeProtocol implements SellerProtoc
taskRunner.addTasks( taskRunner.addTasks(
SellerProcessCounterCurrencyTransferStartedMessage.class, SellerProcessCounterCurrencyTransferStartedMessage.class,
TakerVerifyMakerAccount.class, TakerVerifyMakerAccount.class,
ApplyFilter.class,
TakerVerifyMakerFeePayment.class TakerVerifyMakerFeePayment.class
); );
taskRunner.run(); taskRunner.run();