Get payment method ID from offerPayload.

Was getting an NPE with closed trades older than v1.7.0.
makerPaymentMethodId was new at that point (null for older trades).
makerPaymentAccountPayload can be null for trades where we have
removed account info for privacy reasons (see #6001).
The payment method ID can always be obtained from offerPayload.
This commit is contained in:
jmacxx 2022-02-21 10:59:32 -06:00 committed by Christoph Atteneder
parent 99be324aba
commit 2bdfa524cf
No known key found for this signature in database
GPG key ID: CD5DC1C529CDFD3B

View file

@ -298,8 +298,8 @@ public final class Contract implements NetworkPayload {
}
public String getPaymentMethodId() {
// Either makerPaymentMethodId is set or available in makerPaymentAccountPayload
return makerPaymentMethodId != null ? makerPaymentMethodId : Objects.requireNonNull(makerPaymentAccountPayload).getPaymentMethodId();
// Either makerPaymentMethodId is set or available in offerPayload
return makerPaymentMethodId != null ? makerPaymentMethodId : Objects.requireNonNull(getOfferPayload()).getPaymentMethodId();
}
public Coin getTradeAmount() {