From 36657f55326b09a7301fe9c2b564227d29c04e83 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Tue, 12 Jan 2021 17:43:27 -0500 Subject: [PATCH] Use TradeMailboxMessage as type for getMessage in SendMailboxMessageTask --- .../core/trade/protocol/tasks/SendMailboxMessageTask.java | 5 +++-- .../arbitration/SendPeerPublishedDelayedPayoutTxMessage.java | 4 ++-- .../BuyerSendCounterCurrencyTransferStartedMessage.java | 3 ++- .../mediation/SendMediatedPayoutTxPublishedMessage.java | 4 ++-- .../tasks/seller/SellerSendPayoutTxPublishedMessage.java | 4 ++-- .../SellerSendsDepositTxAndDelayedPayoutTxMessage.java | 3 ++- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/bisq/core/trade/protocol/tasks/SendMailboxMessageTask.java b/core/src/main/java/bisq/core/trade/protocol/tasks/SendMailboxMessageTask.java index 9912fecc00..6cad2692ec 100644 --- a/core/src/main/java/bisq/core/trade/protocol/tasks/SendMailboxMessageTask.java +++ b/core/src/main/java/bisq/core/trade/protocol/tasks/SendMailboxMessageTask.java @@ -18,6 +18,7 @@ package bisq.core.trade.protocol.tasks; import bisq.core.trade.Trade; +import bisq.core.trade.messages.TradeMailboxMessage; import bisq.core.trade.messages.TradeMessage; import bisq.network.p2p.NodeAddress; @@ -33,7 +34,7 @@ public abstract class SendMailboxMessageTask extends TradeTask { super(taskHandler, trade); } - protected abstract TradeMessage getMessage(String id); + protected abstract TradeMailboxMessage getMessage(String id); protected abstract void setStateSent(); @@ -48,7 +49,7 @@ public abstract class SendMailboxMessageTask extends TradeTask { try { runInterceptHook(); String id = processModel.getOfferId(); - TradeMessage message = getMessage(id); + TradeMailboxMessage message = getMessage(id); setStateSent(); NodeAddress peersNodeAddress = trade.getTradingPeerNodeAddress(); log.info("Send {} to peer {}. tradeId={}, uid={}", diff --git a/core/src/main/java/bisq/core/trade/protocol/tasks/arbitration/SendPeerPublishedDelayedPayoutTxMessage.java b/core/src/main/java/bisq/core/trade/protocol/tasks/arbitration/SendPeerPublishedDelayedPayoutTxMessage.java index dde273008a..e743053bf2 100644 --- a/core/src/main/java/bisq/core/trade/protocol/tasks/arbitration/SendPeerPublishedDelayedPayoutTxMessage.java +++ b/core/src/main/java/bisq/core/trade/protocol/tasks/arbitration/SendPeerPublishedDelayedPayoutTxMessage.java @@ -19,7 +19,7 @@ package bisq.core.trade.protocol.tasks.arbitration; import bisq.core.trade.Trade; import bisq.core.trade.messages.PeerPublishedDelayedPayoutTxMessage; -import bisq.core.trade.messages.TradeMessage; +import bisq.core.trade.messages.TradeMailboxMessage; import bisq.core.trade.protocol.tasks.SendMailboxMessageTask; import bisq.common.taskrunner.TaskRunner; @@ -36,7 +36,7 @@ public class SendPeerPublishedDelayedPayoutTxMessage extends SendMailboxMessageT } @Override - protected TradeMessage getMessage(String id) { + protected TradeMailboxMessage getMessage(String id) { return new PeerPublishedDelayedPayoutTxMessage(UUID.randomUUID().toString(), trade.getId(), trade.getTradingPeerNodeAddress()); diff --git a/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerSendCounterCurrencyTransferStartedMessage.java b/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerSendCounterCurrencyTransferStartedMessage.java index bfe50a9be1..583579e9a5 100644 --- a/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerSendCounterCurrencyTransferStartedMessage.java +++ b/core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerSendCounterCurrencyTransferStartedMessage.java @@ -21,6 +21,7 @@ import bisq.core.btc.model.AddressEntry; import bisq.core.network.MessageState; import bisq.core.trade.Trade; import bisq.core.trade.messages.CounterCurrencyTransferStartedMessage; +import bisq.core.trade.messages.TradeMailboxMessage; import bisq.core.trade.messages.TradeMessage; import bisq.core.trade.protocol.tasks.SendMailboxMessageTask; @@ -57,7 +58,7 @@ public class BuyerSendCounterCurrencyTransferStartedMessage extends SendMailboxM } @Override - protected TradeMessage getMessage(String tradeId) { + protected TradeMailboxMessage getMessage(String tradeId) { if (message == null) { AddressEntry payoutAddressEntry = processModel.getBtcWalletService().getOrCreateAddressEntry(tradeId, AddressEntry.Context.TRADE_PAYOUT); diff --git a/core/src/main/java/bisq/core/trade/protocol/tasks/mediation/SendMediatedPayoutTxPublishedMessage.java b/core/src/main/java/bisq/core/trade/protocol/tasks/mediation/SendMediatedPayoutTxPublishedMessage.java index c4c4287920..ad07252807 100644 --- a/core/src/main/java/bisq/core/trade/protocol/tasks/mediation/SendMediatedPayoutTxPublishedMessage.java +++ b/core/src/main/java/bisq/core/trade/protocol/tasks/mediation/SendMediatedPayoutTxPublishedMessage.java @@ -20,7 +20,7 @@ package bisq.core.trade.protocol.tasks.mediation; import bisq.core.support.dispute.mediation.MediationResultState; import bisq.core.trade.Trade; import bisq.core.trade.messages.MediatedPayoutTxPublishedMessage; -import bisq.core.trade.messages.TradeMessage; +import bisq.core.trade.messages.TradeMailboxMessage; import bisq.core.trade.protocol.tasks.SendMailboxMessageTask; import bisq.common.taskrunner.TaskRunner; @@ -41,7 +41,7 @@ public class SendMediatedPayoutTxPublishedMessage extends SendMailboxMessageTask } @Override - protected TradeMessage getMessage(String id) { + protected TradeMailboxMessage getMessage(String id) { Transaction payoutTx = checkNotNull(trade.getPayoutTx(), "trade.getPayoutTx() must not be null"); return new MediatedPayoutTxPublishedMessage( id, diff --git a/core/src/main/java/bisq/core/trade/protocol/tasks/seller/SellerSendPayoutTxPublishedMessage.java b/core/src/main/java/bisq/core/trade/protocol/tasks/seller/SellerSendPayoutTxPublishedMessage.java index a7da42bece..8881c99ff4 100644 --- a/core/src/main/java/bisq/core/trade/protocol/tasks/seller/SellerSendPayoutTxPublishedMessage.java +++ b/core/src/main/java/bisq/core/trade/protocol/tasks/seller/SellerSendPayoutTxPublishedMessage.java @@ -21,7 +21,7 @@ import bisq.core.account.sign.SignedWitness; import bisq.core.account.witness.AccountAgeWitnessService; import bisq.core.trade.Trade; import bisq.core.trade.messages.PayoutTxPublishedMessage; -import bisq.core.trade.messages.TradeMessage; +import bisq.core.trade.messages.TradeMailboxMessage; import bisq.core.trade.protocol.tasks.SendMailboxMessageTask; import bisq.common.taskrunner.TaskRunner; @@ -43,7 +43,7 @@ public class SellerSendPayoutTxPublishedMessage extends SendMailboxMessageTask { } @Override - protected TradeMessage getMessage(String id) { + protected TradeMailboxMessage getMessage(String id) { Transaction payoutTx = checkNotNull(trade.getPayoutTx(), "trade.getPayoutTx() must not be null"); AccountAgeWitnessService accountAgeWitnessService = processModel.getAccountAgeWitnessService(); diff --git a/core/src/main/java/bisq/core/trade/protocol/tasks/seller/SellerSendsDepositTxAndDelayedPayoutTxMessage.java b/core/src/main/java/bisq/core/trade/protocol/tasks/seller/SellerSendsDepositTxAndDelayedPayoutTxMessage.java index 18768093f7..33abff288b 100644 --- a/core/src/main/java/bisq/core/trade/protocol/tasks/seller/SellerSendsDepositTxAndDelayedPayoutTxMessage.java +++ b/core/src/main/java/bisq/core/trade/protocol/tasks/seller/SellerSendsDepositTxAndDelayedPayoutTxMessage.java @@ -20,6 +20,7 @@ package bisq.core.trade.protocol.tasks.seller; import bisq.core.network.MessageState; import bisq.core.trade.Trade; import bisq.core.trade.messages.DepositTxAndDelayedPayoutTxMessage; +import bisq.core.trade.messages.TradeMailboxMessage; import bisq.core.trade.messages.TradeMessage; import bisq.core.trade.protocol.tasks.SendMailboxMessageTask; @@ -56,7 +57,7 @@ public class SellerSendsDepositTxAndDelayedPayoutTxMessage extends SendMailboxMe } @Override - protected TradeMessage getMessage(String tradeId) { + protected TradeMailboxMessage getMessage(String tradeId) { if (message == null) { // We do not use a real unique ID here as we want to be able to re-send the exact same message in case the // peer does not respond with an ACK msg in a certain time interval. To avoid that we get dangling mailbox