defer dispute payout tx if awaiting peer ack

This commit is contained in:
woodser 2024-04-30 12:52:24 -04:00
parent 467b678ea7
commit e2f19c280e

View file

@ -739,12 +739,12 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
boolean exists = disputeResult.getChatMessage() != null && disputeResult.getChatMessage().getMessage() != null && !disputeResult.getChatMessage().getMessage().isEmpty(); boolean exists = disputeResult.getChatMessage() != null && disputeResult.getChatMessage().getMessage() != null && !disputeResult.getChatMessage().getMessage().isEmpty();
if (!exists) { if (!exists) {
ChatMessage chatMessage = new ChatMessage( ChatMessage chatMessage = new ChatMessage(
getSupportType(), getSupportType(),
dispute.getTradeId(), dispute.getTradeId(),
dispute.getTraderPubKeyRing().hashCode(), dispute.getTraderPubKeyRing().hashCode(),
false, false,
summaryText, summaryText,
p2PService.getAddress()); p2PService.getAddress());
disputeResult.setChatMessage(chatMessage); disputeResult.setChatMessage(chatMessage);
dispute.addAndPersistChatMessage(chatMessage); dispute.addAndPersistChatMessage(chatMessage);
} }
@ -757,8 +757,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
// create dispute closed message // create dispute closed message
TradePeer receiverPeer = receiver == trade.getBuyer() ? trade.getSeller() : trade.getBuyer(); TradePeer receiverPeer = receiver == trade.getBuyer() ? trade.getSeller() : trade.getBuyer();
boolean deferPublishPayout = !exists && receiver.getUnsignedPayoutTxHex() != null && receiverPeer.getUpdatedMultisigHex() != null && trade.getDisputeState().ordinal() >= Trade.DisputeState.ARBITRATOR_SAW_ARRIVED_DISPUTE_CLOSED_MSG.ordinal(); boolean deferPublishPayout = !exists && receiver.getUnsignedPayoutTxHex() != null && receiverPeer.getUpdatedMultisigHex() != null && (trade.getDisputeState() == Trade.DisputeState.ARBITRATOR_SENT_DISPUTE_CLOSED_MSG || trade.getDisputeState() == Trade.DisputeState.ARBITRATOR_SAW_ARRIVED_DISPUTE_CLOSED_MSG);
log.info("deferPublishPayout = {} = {} && {} && {} && {}", deferPublishPayout, !exists, receiver.getUnsignedPayoutTxHex() != null, receiverPeer.getUpdatedMultisigHex() != null, trade.getDisputeState().ordinal() >= Trade.DisputeState.ARBITRATOR_SAW_ARRIVED_DISPUTE_CLOSED_MSG.ordinal());
DisputeClosedMessage disputeClosedMessage = new DisputeClosedMessage(disputeResult, DisputeClosedMessage disputeClosedMessage = new DisputeClosedMessage(disputeResult,
p2PService.getAddress(), p2PService.getAddress(),
UUID.randomUUID().toString(), UUID.randomUUID().toString(),