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()); 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 // verify buyer signature of payment sent message
verifyPaymentSentMessage(trade, message.getPaymentSentMessage()); if (message.getPaymentSentMessage() != null) verifyPaymentSentMessage(trade, message.getPaymentSentMessage());
} }
// ----------------------------- OTHER UTILS ------------------------------ // ----------------------------- OTHER UTILS ------------------------------

View File

@ -46,6 +46,7 @@ public final class PaymentReceivedMessage extends TradeMailboxMessage {
private final AccountAgeWitness buyerAccountAgeWitness; private final AccountAgeWitness buyerAccountAgeWitness;
@Nullable @Nullable
private final SignedWitness buyerSignedWitness; private final SignedWitness buyerSignedWitness;
@Nullable
private final PaymentSentMessage paymentSentMessage; private final PaymentSentMessage paymentSentMessage;
@Setter @Setter
@Nullable @Nullable
@ -60,7 +61,7 @@ public final class PaymentReceivedMessage extends TradeMailboxMessage {
boolean deferPublishPayout, boolean deferPublishPayout,
AccountAgeWitness buyerAccountAgeWitness, AccountAgeWitness buyerAccountAgeWitness,
@Nullable SignedWitness buyerSignedWitness, @Nullable SignedWitness buyerSignedWitness,
PaymentSentMessage paymentSentMessage) { @Nullable PaymentSentMessage paymentSentMessage) {
this(tradeId, this(tradeId,
senderNodeAddress, senderNodeAddress,
uid, uid,

View File

@ -70,8 +70,12 @@ public class ProcessPaymentReceivedMessage extends TradeTask {
// set state // set state
trade.getSeller().setUpdatedMultisigHex(message.getUpdatedMultisigHex()); trade.getSeller().setUpdatedMultisigHex(message.getUpdatedMultisigHex());
trade.getBuyer().setUpdatedMultisigHex(message.getPaymentSentMessage().getUpdatedMultisigHex());
trade.getBuyer().setAccountAgeWitness(message.getBuyerAccountAgeWitness()); 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(); trade.requestPersistence();
// close open disputes // close open disputes
@ -138,7 +142,7 @@ public class ProcessPaymentReceivedMessage extends TradeTask {
PaymentSentMessage paymentSentMessage = (trade.isArbitrator() ? trade.getBuyer() : trade.getArbitrator()).getPaymentSentMessage(); 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 (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 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); trade.verifyPayoutTx(message.getUnsignedPayoutTxHex(), true, true);
} else { } else {
log.info("{} {} re-verifying and publishing payout tx", trade.getClass().getSimpleName(), trade.getId()); 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.getState().ordinal() >= Trade.State.SELLER_SAW_ARRIVED_PAYMENT_RECEIVED_MSG.ordinal(), // informs to expect payout
trade.getTradePeer().getAccountAgeWitness(), trade.getTradePeer().getAccountAgeWitness(),
signedWitness, signedWitness,
trade.getBuyer().getPaymentSentMessage() getReceiver() == trade.getArbitrator() ? trade.getBuyer().getPaymentSentMessage() : null // buyer already has payment sent message
); );
// sign message // sign message