From dbb3d4f89156b8b266fb0514d705422b597170e8 Mon Sep 17 00:00:00 2001 From: woodser Date: Fri, 2 Aug 2024 15:16:47 -0400 Subject: [PATCH] offer key images are null when not initialized --- core/src/main/java/haveno/core/offer/OfferPayload.java | 4 +++- core/src/main/java/haveno/core/offer/OpenOfferManager.java | 2 +- .../offer/placeoffer/tasks/MakerReserveOfferFunds.java | 7 ++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/haveno/core/offer/OfferPayload.java b/core/src/main/java/haveno/core/offer/OfferPayload.java index 2f377baba8..fa05685dee 100644 --- a/core/src/main/java/haveno/core/offer/OfferPayload.java +++ b/core/src/main/java/haveno/core/offer/OfferPayload.java @@ -390,6 +390,8 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay null : new ArrayList<>(proto.getAcceptedBankIdsList()); List acceptedCountryCodes = proto.getAcceptedCountryCodesList().isEmpty() ? null : new ArrayList<>(proto.getAcceptedCountryCodesList()); + List reserveTxKeyImages = proto.getReserveTxKeyImagesList().isEmpty() ? + null : new ArrayList<>(proto.getReserveTxKeyImagesList()); String hashOfChallenge = ProtoUtil.stringOrNullFromProto(proto.getHashOfChallenge()); Map extraDataMapMap = CollectionUtils.isEmpty(proto.getExtraDataMap()) ? null : proto.getExtraDataMap(); @@ -431,7 +433,7 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay proto.getProtocolVersion(), proto.hasArbitratorSigner() ? NodeAddress.fromProto(proto.getArbitratorSigner()) : null, ProtoUtil.byteArrayOrNullFromProto(proto.getArbitratorSignature()), - proto.getReserveTxKeyImagesList() == null ? null : new ArrayList(proto.getReserveTxKeyImagesList())); + reserveTxKeyImages); } @Override diff --git a/core/src/main/java/haveno/core/offer/OpenOfferManager.java b/core/src/main/java/haveno/core/offer/OpenOfferManager.java index eab1bafffe..9c0626faca 100644 --- a/core/src/main/java/haveno/core/offer/OpenOfferManager.java +++ b/core/src/main/java/haveno/core/offer/OpenOfferManager.java @@ -1754,7 +1754,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe log.warn("Offer {} has invalid arbitrator signature, reposting", openOffer.getId()); isValid = false; } - if (openOffer.getOffer().getOfferPayload().getReserveTxKeyImages() != null && (openOffer.getReserveTxHash() == null || openOffer.getReserveTxHash().isEmpty())) { + if ((openOffer.getOffer().getOfferPayload().getReserveTxKeyImages() != null || openOffer.getOffer().getOfferPayload().getReserveTxKeyImages().isEmpty()) && (openOffer.getReserveTxHash() == null || openOffer.getReserveTxHash().isEmpty())) { log.warn("Offer {} is missing reserve tx hash but has reserved key images, reposting", openOffer.getId()); isValid = false; } diff --git a/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerReserveOfferFunds.java b/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerReserveOfferFunds.java index 3388368a77..200cad8c03 100644 --- a/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerReserveOfferFunds.java +++ b/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerReserveOfferFunds.java @@ -102,11 +102,8 @@ public class MakerReserveOfferFunds extends Task { // reset state with wallet lock model.getXmrWalletService().resetAddressEntriesForOpenOffer(offer.getId()); - if (reserveTx != null) { - model.getXmrWalletService().thawOutputs(HavenoUtils.getInputKeyImages(reserveTx)); - offer.getOfferPayload().setReserveTxKeyImages(null); - } - + if (reserveTx != null) model.getXmrWalletService().thawOutputs(HavenoUtils.getInputKeyImages(reserveTx)); + offer.getOfferPayload().setReserveTxKeyImages(null); throw e; }