diff --git a/core/src/main/java/haveno/core/api/CoreOffersService.java b/core/src/main/java/haveno/core/api/CoreOffersService.java index 7e67965c..5bdd2f16 100644 --- a/core/src/main/java/haveno/core/api/CoreOffersService.java +++ b/core/src/main/java/haveno/core/api/CoreOffersService.java @@ -284,6 +284,7 @@ public class CoreOffersService { useSavingsWallet, triggerPriceAsLong, reserveExactAmount, + true, resultHandler::accept, errorMessageHandler); } diff --git a/core/src/main/java/haveno/core/offer/OpenOfferManager.java b/core/src/main/java/haveno/core/offer/OpenOfferManager.java index 4824579d..38ee71f6 100644 --- a/core/src/main/java/haveno/core/offer/OpenOfferManager.java +++ b/core/src/main/java/haveno/core/offer/OpenOfferManager.java @@ -541,6 +541,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe boolean useSavingsWallet, long triggerPrice, boolean reserveExactAmount, + boolean resetAddressEntriesOnError, TransactionResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { @@ -559,7 +560,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe }, (errorMessage) -> { if (!openOffer.isCanceled()) { log.warn("Error processing pending offer {}: {}", openOffer.getId(), errorMessage); - doCancelOffer(openOffer); + doCancelOffer(openOffer, resetAddressEntriesOnError); } latch.countDown(); errorMessageHandler.handleErrorMessage(errorMessage); @@ -715,14 +716,18 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe } } + private void doCancelOffer(OpenOffer openOffer) { + doCancelOffer(openOffer, true); + } + // remove open offer which thaws its key images - private void doCancelOffer(@NotNull OpenOffer openOffer) { + private void doCancelOffer(@NotNull OpenOffer openOffer, boolean resetAddressEntries) { Offer offer = openOffer.getOffer(); offer.setState(Offer.State.REMOVED); openOffer.setState(OpenOffer.State.CANCELED); removeOpenOffer(openOffer); closedTradableManager.add(openOffer); // TODO: don't add these to closed tradables? - xmrWalletService.resetAddressEntriesForOpenOffer(offer.getId()); + if (resetAddressEntries) xmrWalletService.resetAddressEntriesForOpenOffer(offer.getId()); requestPersistence(); xmrWalletService.thawOutputs(offer.getOfferPayload().getReserveTxKeyImages()); } diff --git a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java index e6d1d9d4..d48a1d2e 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java @@ -296,6 +296,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel { useSavingsWallet, triggerPrice, reserveExactAmount, + false, // desktop ui resets address entries on cancel resultHandler, errorMessageHandler); }