mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-02-27 01:41:27 -05:00
set arbitrator payment account payloads on dispute opened
This commit is contained in:
parent
e4714aab89
commit
a6af1550a4
@ -537,15 +537,21 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
|
||||
throw e;
|
||||
}
|
||||
|
||||
// try to validate payment account
|
||||
// try to validate payment accounts
|
||||
try {
|
||||
DisputeValidation.validatePaymentAccountPayload(dispute); // TODO: add field to dispute details: valid, invalid, missing
|
||||
DisputeValidation.validatePaymentAccountPayloads(dispute); // TODO: add field to dispute details: valid, invalid, missing
|
||||
} catch (Exception e) {
|
||||
log.error(ExceptionUtils.getStackTrace(e));
|
||||
trade.prependErrorMessage(e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
|
||||
// set arbitrator's payment account payloads
|
||||
if (trade.isArbitrator()) {
|
||||
if (trade.getBuyer().getPaymentAccountPayload() == null) trade.getBuyer().setPaymentAccountPayload(dispute.getBuyerPaymentAccountPayload());
|
||||
if (trade.getSeller().getPaymentAccountPayload() == null) trade.getSeller().setPaymentAccountPayload(dispute.getSellerPaymentAccountPayload());
|
||||
}
|
||||
|
||||
// get sender
|
||||
TradePeer sender;
|
||||
if (reOpen) { // re-open can come from either peer
|
||||
|
@ -41,9 +41,12 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
@Slf4j
|
||||
public class DisputeValidation {
|
||||
|
||||
public static void validatePaymentAccountPayload(Dispute dispute) throws ValidationException {
|
||||
public static void validatePaymentAccountPayloads(Dispute dispute) throws ValidationException {
|
||||
if (dispute.getSellerPaymentAccountPayload() == null) throw new ValidationException(dispute, "Seller's payment account payload is null in dispute opened for trade " + dispute.getTradeId());
|
||||
if (!Arrays.equals(dispute.getSellerPaymentAccountPayload().getHash(), dispute.getContract().getSellerPaymentAccountPayloadHash())) throw new ValidationException(dispute, "Hash of maker's payment account payload does not match contract");
|
||||
if (!Arrays.equals(dispute.getSellerPaymentAccountPayload().getHash(), dispute.getContract().getSellerPaymentAccountPayloadHash())) throw new ValidationException(dispute, "Hash of seller's payment account payload does not match contract");
|
||||
if (dispute.getBuyerPaymentAccountPayload() != null) {
|
||||
if (!Arrays.equals(dispute.getBuyerPaymentAccountPayload().getHash(), dispute.getContract().getBuyerPaymentAccountPayloadHash())) throw new ValidationException(dispute, "Hash of buyer's payment account payload does not match contract");
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateDisputeData(Dispute dispute) throws ValidationException {
|
||||
|
Loading…
x
Reference in New Issue
Block a user