trader can re-open dispute unless payout confirmed

This commit is contained in:
woodser 2024-11-13 12:00:24 -05:00
parent 5221782ba0
commit 59d8a8ee44

View File

@ -359,6 +359,13 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
return;
}
// skip if payout is confirmed
if (trade.isPayoutConfirmed()) {
String errorMsg = "Cannot open dispute because payout is already confirmed for " + trade.getClass().getSimpleName() + " " + trade.getId();
faultHandler.handleFault(errorMsg, new IllegalStateException(errorMsg));
return;
}
synchronized (disputeList.getObservableList()) {
if (disputeList.contains(dispute)) {
String msg = "We got a dispute msg that we have already stored. TradeId = " + dispute.getTradeId() + ", DisputeId = " + dispute.getId();
@ -368,8 +375,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
}
Optional<Dispute> storedDisputeOptional = findDispute(dispute);
boolean reOpen = storedDisputeOptional.isPresent() && storedDisputeOptional.get().isClosed();
if (!storedDisputeOptional.isPresent() || reOpen) {
boolean reOpen = storedDisputeOptional.isPresent();
// add or re-open dispute
if (reOpen) {
@ -472,12 +478,6 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
errorMessage, new DisputeMessageDeliveryFailedException());
}
});
} else {
String msg = "We got a dispute already open for that trade and trading peer.\n" +
"TradeId = " + dispute.getTradeId();
log.warn(msg);
faultHandler.handleFault(msg, new DisputeAlreadyOpenException());
}
}
requestPersistence();