mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-02-26 17:31: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;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to validate payment account
|
// try to validate payment accounts
|
||||||
try {
|
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) {
|
} catch (Exception e) {
|
||||||
log.error(ExceptionUtils.getStackTrace(e));
|
log.error(ExceptionUtils.getStackTrace(e));
|
||||||
trade.prependErrorMessage(e.getMessage());
|
trade.prependErrorMessage(e.getMessage());
|
||||||
throw e;
|
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
|
// get sender
|
||||||
TradePeer sender;
|
TradePeer sender;
|
||||||
if (reOpen) { // re-open can come from either peer
|
if (reOpen) { // re-open can come from either peer
|
||||||
|
@ -41,9 +41,12 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class DisputeValidation {
|
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 (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 {
|
public static void validateDisputeData(Dispute dispute) throws ValidationException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user