mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04:00
thaw outputs off main thread on cancel offer
This commit is contained in:
parent
6b34651101
commit
399d4e0512
@ -618,13 +618,17 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||||||
ErrorMessageHandler errorMessageHandler) {
|
ErrorMessageHandler errorMessageHandler) {
|
||||||
if (!offersToBeEdited.containsKey(openOffer.getId())) {
|
if (!offersToBeEdited.containsKey(openOffer.getId())) {
|
||||||
if (openOffer.isDeactivated()) {
|
if (openOffer.isDeactivated()) {
|
||||||
|
ThreadUtils.execute(() -> {
|
||||||
onCancelled(openOffer);
|
onCancelled(openOffer);
|
||||||
resultHandler.handleResult();
|
resultHandler.handleResult();
|
||||||
|
}, THREAD_ID);
|
||||||
} else {
|
} else {
|
||||||
offerBookService.removeOffer(openOffer.getOffer().getOfferPayload(),
|
offerBookService.removeOffer(openOffer.getOffer().getOfferPayload(),
|
||||||
() -> {
|
() -> {
|
||||||
|
ThreadUtils.execute(() -> { // TODO: this runs off thread and then shows popup when done. should show overlay spinner until done
|
||||||
onCancelled(openOffer);
|
onCancelled(openOffer);
|
||||||
resultHandler.handleResult();
|
resultHandler.handleResult();
|
||||||
|
}, THREAD_ID);
|
||||||
},
|
},
|
||||||
errorMessageHandler);
|
errorMessageHandler);
|
||||||
}
|
}
|
||||||
@ -705,14 +709,13 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||||||
// remove open offer which thaws its key images
|
// remove open offer which thaws its key images
|
||||||
private void onCancelled(@NotNull OpenOffer openOffer) {
|
private void onCancelled(@NotNull OpenOffer openOffer) {
|
||||||
Offer offer = openOffer.getOffer();
|
Offer offer = openOffer.getOffer();
|
||||||
xmrWalletService.thawOutputs(offer.getOfferPayload().getReserveTxKeyImages());
|
|
||||||
offer.setState(Offer.State.REMOVED);
|
offer.setState(Offer.State.REMOVED);
|
||||||
openOffer.setState(OpenOffer.State.CANCELED);
|
openOffer.setState(OpenOffer.State.CANCELED);
|
||||||
removeOpenOffer(openOffer);
|
removeOpenOffer(openOffer);
|
||||||
closedTradableManager.add(openOffer);
|
closedTradableManager.add(openOffer);
|
||||||
xmrWalletService.resetAddressEntriesForOpenOffer(offer.getId());
|
xmrWalletService.resetAddressEntriesForOpenOffer(offer.getId());
|
||||||
log.info("onRemoved offerId={}", offer.getId());
|
|
||||||
requestPersistence();
|
requestPersistence();
|
||||||
|
xmrWalletService.thawOutputs(offer.getOfferPayload().getReserveTxKeyImages());
|
||||||
}
|
}
|
||||||
|
|
||||||
// close open offer after key images spent
|
// close open offer after key images spent
|
||||||
@ -793,19 +796,21 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addOpenOffer(OpenOffer openOffer) {
|
private void addOpenOffer(OpenOffer openOffer) {
|
||||||
|
log.info("Adding open offer {}", openOffer.getId());
|
||||||
synchronized (openOffers) {
|
synchronized (openOffers) {
|
||||||
openOffers.add(openOffer);
|
openOffers.add(openOffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeOpenOffer(OpenOffer openOffer) {
|
private void removeOpenOffer(OpenOffer openOffer) {
|
||||||
|
log.info("Removing open offer {}", openOffer.getId());
|
||||||
synchronized (openOffers) {
|
synchronized (openOffers) {
|
||||||
openOffers.remove(openOffer);
|
openOffers.remove(openOffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSignedOffer(SignedOffer signedOffer) {
|
private void addSignedOffer(SignedOffer signedOffer) {
|
||||||
log.info("Adding SignedOffer offer for offer {}", signedOffer.getOfferId());
|
log.info("Adding SignedOffer for offer {}", signedOffer.getOfferId());
|
||||||
synchronized (signedOffers) {
|
synchronized (signedOffers) {
|
||||||
|
|
||||||
// remove signed offers with common key images
|
// remove signed offers with common key images
|
||||||
|
Loading…
Reference in New Issue
Block a user