Use TradeMailboxMessage as type for getMessage in SendMailboxMessageTask

This commit is contained in:
chimp1984 2021-01-12 17:43:27 -05:00
parent 3834785828
commit 36657f5532
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
6 changed files with 13 additions and 10 deletions

View File

@ -18,6 +18,7 @@
package bisq.core.trade.protocol.tasks; package bisq.core.trade.protocol.tasks;
import bisq.core.trade.Trade; import bisq.core.trade.Trade;
import bisq.core.trade.messages.TradeMailboxMessage;
import bisq.core.trade.messages.TradeMessage; import bisq.core.trade.messages.TradeMessage;
import bisq.network.p2p.NodeAddress; import bisq.network.p2p.NodeAddress;
@ -33,7 +34,7 @@ public abstract class SendMailboxMessageTask extends TradeTask {
super(taskHandler, trade); super(taskHandler, trade);
} }
protected abstract TradeMessage getMessage(String id); protected abstract TradeMailboxMessage getMessage(String id);
protected abstract void setStateSent(); protected abstract void setStateSent();
@ -48,7 +49,7 @@ public abstract class SendMailboxMessageTask extends TradeTask {
try { try {
runInterceptHook(); runInterceptHook();
String id = processModel.getOfferId(); String id = processModel.getOfferId();
TradeMessage message = getMessage(id); TradeMailboxMessage message = getMessage(id);
setStateSent(); setStateSent();
NodeAddress peersNodeAddress = trade.getTradingPeerNodeAddress(); NodeAddress peersNodeAddress = trade.getTradingPeerNodeAddress();
log.info("Send {} to peer {}. tradeId={}, uid={}", log.info("Send {} to peer {}. tradeId={}, uid={}",

View File

@ -19,7 +19,7 @@ package bisq.core.trade.protocol.tasks.arbitration;
import bisq.core.trade.Trade; import bisq.core.trade.Trade;
import bisq.core.trade.messages.PeerPublishedDelayedPayoutTxMessage; 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.core.trade.protocol.tasks.SendMailboxMessageTask;
import bisq.common.taskrunner.TaskRunner; import bisq.common.taskrunner.TaskRunner;
@ -36,7 +36,7 @@ public class SendPeerPublishedDelayedPayoutTxMessage extends SendMailboxMessageT
} }
@Override @Override
protected TradeMessage getMessage(String id) { protected TradeMailboxMessage getMessage(String id) {
return new PeerPublishedDelayedPayoutTxMessage(UUID.randomUUID().toString(), return new PeerPublishedDelayedPayoutTxMessage(UUID.randomUUID().toString(),
trade.getId(), trade.getId(),
trade.getTradingPeerNodeAddress()); trade.getTradingPeerNodeAddress());

View File

@ -21,6 +21,7 @@ import bisq.core.btc.model.AddressEntry;
import bisq.core.network.MessageState; import bisq.core.network.MessageState;
import bisq.core.trade.Trade; import bisq.core.trade.Trade;
import bisq.core.trade.messages.CounterCurrencyTransferStartedMessage; import bisq.core.trade.messages.CounterCurrencyTransferStartedMessage;
import bisq.core.trade.messages.TradeMailboxMessage;
import bisq.core.trade.messages.TradeMessage; import bisq.core.trade.messages.TradeMessage;
import bisq.core.trade.protocol.tasks.SendMailboxMessageTask; import bisq.core.trade.protocol.tasks.SendMailboxMessageTask;
@ -57,7 +58,7 @@ public class BuyerSendCounterCurrencyTransferStartedMessage extends SendMailboxM
} }
@Override @Override
protected TradeMessage getMessage(String tradeId) { protected TradeMailboxMessage getMessage(String tradeId) {
if (message == null) { if (message == null) {
AddressEntry payoutAddressEntry = processModel.getBtcWalletService().getOrCreateAddressEntry(tradeId, AddressEntry payoutAddressEntry = processModel.getBtcWalletService().getOrCreateAddressEntry(tradeId,
AddressEntry.Context.TRADE_PAYOUT); AddressEntry.Context.TRADE_PAYOUT);

View File

@ -20,7 +20,7 @@ package bisq.core.trade.protocol.tasks.mediation;
import bisq.core.support.dispute.mediation.MediationResultState; import bisq.core.support.dispute.mediation.MediationResultState;
import bisq.core.trade.Trade; import bisq.core.trade.Trade;
import bisq.core.trade.messages.MediatedPayoutTxPublishedMessage; 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.core.trade.protocol.tasks.SendMailboxMessageTask;
import bisq.common.taskrunner.TaskRunner; import bisq.common.taskrunner.TaskRunner;
@ -41,7 +41,7 @@ public class SendMediatedPayoutTxPublishedMessage extends SendMailboxMessageTask
} }
@Override @Override
protected TradeMessage getMessage(String id) { protected TradeMailboxMessage getMessage(String id) {
Transaction payoutTx = checkNotNull(trade.getPayoutTx(), "trade.getPayoutTx() must not be null"); Transaction payoutTx = checkNotNull(trade.getPayoutTx(), "trade.getPayoutTx() must not be null");
return new MediatedPayoutTxPublishedMessage( return new MediatedPayoutTxPublishedMessage(
id, id,

View File

@ -21,7 +21,7 @@ import bisq.core.account.sign.SignedWitness;
import bisq.core.account.witness.AccountAgeWitnessService; import bisq.core.account.witness.AccountAgeWitnessService;
import bisq.core.trade.Trade; import bisq.core.trade.Trade;
import bisq.core.trade.messages.PayoutTxPublishedMessage; 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.core.trade.protocol.tasks.SendMailboxMessageTask;
import bisq.common.taskrunner.TaskRunner; import bisq.common.taskrunner.TaskRunner;
@ -43,7 +43,7 @@ public class SellerSendPayoutTxPublishedMessage extends SendMailboxMessageTask {
} }
@Override @Override
protected TradeMessage getMessage(String id) { protected TradeMailboxMessage getMessage(String id) {
Transaction payoutTx = checkNotNull(trade.getPayoutTx(), "trade.getPayoutTx() must not be null"); Transaction payoutTx = checkNotNull(trade.getPayoutTx(), "trade.getPayoutTx() must not be null");
AccountAgeWitnessService accountAgeWitnessService = processModel.getAccountAgeWitnessService(); AccountAgeWitnessService accountAgeWitnessService = processModel.getAccountAgeWitnessService();

View File

@ -20,6 +20,7 @@ package bisq.core.trade.protocol.tasks.seller;
import bisq.core.network.MessageState; import bisq.core.network.MessageState;
import bisq.core.trade.Trade; import bisq.core.trade.Trade;
import bisq.core.trade.messages.DepositTxAndDelayedPayoutTxMessage; import bisq.core.trade.messages.DepositTxAndDelayedPayoutTxMessage;
import bisq.core.trade.messages.TradeMailboxMessage;
import bisq.core.trade.messages.TradeMessage; import bisq.core.trade.messages.TradeMessage;
import bisq.core.trade.protocol.tasks.SendMailboxMessageTask; import bisq.core.trade.protocol.tasks.SendMailboxMessageTask;
@ -56,7 +57,7 @@ public class SellerSendsDepositTxAndDelayedPayoutTxMessage extends SendMailboxMe
} }
@Override @Override
protected TradeMessage getMessage(String tradeId) { protected TradeMailboxMessage getMessage(String tradeId) {
if (message == null) { 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 // 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 // peer does not respond with an ACK msg in a certain time interval. To avoid that we get dangling mailbox