diff --git a/core/src/main/java/haveno/core/trade/HavenoUtils.java b/core/src/main/java/haveno/core/trade/HavenoUtils.java index 681046aaee..8df6190dcb 100644 --- a/core/src/main/java/haveno/core/trade/HavenoUtils.java +++ b/core/src/main/java/haveno/core/trade/HavenoUtils.java @@ -411,7 +411,7 @@ public class HavenoUtils { if (!trade.getId().equals(message.getTradeId())) throw new IllegalArgumentException("The " + message.getClass().getSimpleName() + " has the wrong trade id, expected " + trade.getId() + " but was " + message.getTradeId()); // verify buyer signature of payment sent message - verifyPaymentSentMessage(trade, message.getPaymentSentMessage()); + if (message.getPaymentSentMessage() != null) verifyPaymentSentMessage(trade, message.getPaymentSentMessage()); } // ----------------------------- OTHER UTILS ------------------------------ diff --git a/core/src/main/java/haveno/core/trade/messages/PaymentReceivedMessage.java b/core/src/main/java/haveno/core/trade/messages/PaymentReceivedMessage.java index 6a06e582f1..1c34c9da63 100644 --- a/core/src/main/java/haveno/core/trade/messages/PaymentReceivedMessage.java +++ b/core/src/main/java/haveno/core/trade/messages/PaymentReceivedMessage.java @@ -46,6 +46,7 @@ public final class PaymentReceivedMessage extends TradeMailboxMessage { private final AccountAgeWitness buyerAccountAgeWitness; @Nullable private final SignedWitness buyerSignedWitness; + @Nullable private final PaymentSentMessage paymentSentMessage; @Setter @Nullable @@ -60,7 +61,7 @@ public final class PaymentReceivedMessage extends TradeMailboxMessage { boolean deferPublishPayout, AccountAgeWitness buyerAccountAgeWitness, @Nullable SignedWitness buyerSignedWitness, - PaymentSentMessage paymentSentMessage) { + @Nullable PaymentSentMessage paymentSentMessage) { this(tradeId, senderNodeAddress, uid, diff --git a/core/src/main/java/haveno/core/trade/protocol/tasks/ProcessPaymentReceivedMessage.java b/core/src/main/java/haveno/core/trade/protocol/tasks/ProcessPaymentReceivedMessage.java index 5bd51aa285..79cd9890af 100644 --- a/core/src/main/java/haveno/core/trade/protocol/tasks/ProcessPaymentReceivedMessage.java +++ b/core/src/main/java/haveno/core/trade/protocol/tasks/ProcessPaymentReceivedMessage.java @@ -70,8 +70,12 @@ public class ProcessPaymentReceivedMessage extends TradeTask { // set state trade.getSeller().setUpdatedMultisigHex(message.getUpdatedMultisigHex()); - trade.getBuyer().setUpdatedMultisigHex(message.getPaymentSentMessage().getUpdatedMultisigHex()); trade.getBuyer().setAccountAgeWitness(message.getBuyerAccountAgeWitness()); + if (trade.isArbitrator() && trade.getBuyer().getPaymentSentMessage() == null) { + checkNotNull(message.getPaymentSentMessage(), "PaymentSentMessage is null for arbitrator"); + trade.getBuyer().setPaymentSentMessage(message.getPaymentSentMessage()); + trade.getBuyer().setUpdatedMultisigHex(message.getPaymentSentMessage().getUpdatedMultisigHex()); + } trade.requestPersistence(); // close open disputes @@ -138,7 +142,7 @@ public class ProcessPaymentReceivedMessage extends TradeTask { PaymentSentMessage paymentSentMessage = (trade.isArbitrator() ? trade.getBuyer() : trade.getArbitrator()).getPaymentSentMessage(); if (paymentSentMessage == null) throw new RuntimeException("Process model does not have payment sent message for " + trade.getClass().getSimpleName() + " " + trade.getId()); if (StringUtils.equals(trade.getPayoutTxHex(), paymentSentMessage.getPayoutTxHex())) { // unsigned - log.info("{} {} verifying, signing, and publishing seller's payout tx", trade.getClass().getSimpleName(), trade.getId()); + log.info("{} {} verifying, signing, and publishing payout tx", trade.getClass().getSimpleName(), trade.getId()); trade.verifyPayoutTx(message.getUnsignedPayoutTxHex(), true, true); } else { log.info("{} {} re-verifying and publishing payout tx", trade.getClass().getSimpleName(), trade.getId()); diff --git a/core/src/main/java/haveno/core/trade/protocol/tasks/SellerSendPaymentReceivedMessage.java b/core/src/main/java/haveno/core/trade/protocol/tasks/SellerSendPaymentReceivedMessage.java index 2da344f367..78d8537bba 100644 --- a/core/src/main/java/haveno/core/trade/protocol/tasks/SellerSendPaymentReceivedMessage.java +++ b/core/src/main/java/haveno/core/trade/protocol/tasks/SellerSendPaymentReceivedMessage.java @@ -93,7 +93,7 @@ public abstract class SellerSendPaymentReceivedMessage extends SendMailboxMessag trade.getState().ordinal() >= Trade.State.SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG.ordinal(), // informs to expect payout trade.getTradePeer().getAccountAgeWitness(), signedWitness, - trade.getBuyer().getPaymentSentMessage() + getReceiver() == trade.getArbitrator() ? trade.getBuyer().getPaymentSentMessage() : null // buyer already has payment sent message ); // sign message