don't send payment sent message back to buyer

This commit is contained in:
woodser 2023-11-20 08:48:51 -05:00
parent 2e2b077f0e
commit 013924b141
4 changed files with 10 additions and 5 deletions

View file

@ -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 ------------------------------

View file

@ -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,

View file

@ -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());

View file

@ -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