diff --git a/core/src/main/java/bisq/core/offer/Offer.java b/core/src/main/java/bisq/core/offer/Offer.java index bcca0078b4..5c1c4051ef 100644 --- a/core/src/main/java/bisq/core/offer/Offer.java +++ b/core/src/main/java/bisq/core/offer/Offer.java @@ -109,6 +109,10 @@ public class Offer implements NetworkPayload, PersistablePayload { @Setter transient private PriceFeedService priceFeedService; + // Used only as cache + @Nullable + transient private String currencyCode; + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor @@ -346,8 +350,9 @@ public class Offer implements NetworkPayload, PersistablePayload { public Optional getAccountAgeWitnessHashAsHex() { - if (getExtraDataMap() != null && getExtraDataMap().containsKey(OfferPayload.ACCOUNT_AGE_WITNESS_HASH)) - return Optional.of(getExtraDataMap().get(OfferPayload.ACCOUNT_AGE_WITNESS_HASH)); + Map extraDataMap = getExtraDataMap(); + if (extraDataMap != null && extraDataMap.containsKey(OfferPayload.ACCOUNT_AGE_WITNESS_HASH)) + return Optional.of(extraDataMap.get(OfferPayload.ACCOUNT_AGE_WITNESS_HASH)); else return Optional.empty(); } @@ -421,9 +426,14 @@ public class Offer implements NetworkPayload, PersistablePayload { } public String getCurrencyCode() { - return offerPayload.getBaseCurrencyCode().equals("BTC") ? + if (currencyCode != null) { + return currencyCode; + } + + currencyCode = offerPayload.getBaseCurrencyCode().equals("BTC") ? offerPayload.getCounterCurrencyCode() : offerPayload.getBaseCurrencyCode(); + return currencyCode; } public long getProtocolVersion() {