do not reset offer address entries on error from desktop ui form

This commit is contained in:
woodser 2024-10-02 08:19:02 -04:00
parent 047f1a1c1f
commit 5c0f49d58f
3 changed files with 10 additions and 3 deletions

View File

@ -284,6 +284,7 @@ public class CoreOffersService {
useSavingsWallet,
triggerPriceAsLong,
reserveExactAmount,
true,
resultHandler::accept,
errorMessageHandler);
}

View File

@ -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());
}

View File

@ -296,6 +296,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel {
useSavingsWallet,
triggerPrice,
reserveExactAmount,
false, // desktop ui resets address entries on cancel
resultHandler,
errorMessageHandler);
}