unfreeze funds if error during creating offer

fix jfx error
This commit is contained in:
woodser 2022-07-12 18:38:56 -04:00
parent 4a171c9baa
commit 7945514c46
2 changed files with 8 additions and 7 deletions

View File

@ -426,6 +426,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
requestPersistence(); requestPersistence();
resultHandler.handleResult(transaction); resultHandler.handleResult(transaction);
}, (errMessage) -> { }, (errMessage) -> {
onRemoved(openOffer);
errorMessageHandler.handleErrorMessage(errMessage); errorMessageHandler.handleErrorMessage(errMessage);
}); });
} }
@ -478,12 +479,11 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
ResultHandler resultHandler, ResultHandler resultHandler,
ErrorMessageHandler errorMessageHandler) { ErrorMessageHandler errorMessageHandler) {
if (!offersToBeEdited.containsKey(openOffer.getId())) { if (!offersToBeEdited.containsKey(openOffer.getId())) {
Offer offer = openOffer.getOffer();
if (openOffer.isDeactivated()) { if (openOffer.isDeactivated()) {
onRemoved(openOffer, resultHandler, offer); onRemoved(openOffer);
} else { } else {
offerBookService.removeOffer(offer.getOfferPayload(), offerBookService.removeOffer(openOffer.getOffer().getOfferPayload(),
() -> onRemoved(openOffer, resultHandler, offer), () -> onRemoved(openOffer),
errorMessageHandler); errorMessageHandler);
} }
} else { } else {
@ -560,7 +560,8 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
} }
} }
private void onRemoved(@NotNull OpenOffer openOffer, ResultHandler resultHandler, Offer offer) { private void onRemoved(@NotNull OpenOffer openOffer) {
Offer offer = openOffer.getOffer();
if (offer.getOfferPayload().getReserveTxKeyImages() != null) { if (offer.getOfferPayload().getReserveTxKeyImages() != null) {
for (String frozenKeyImage : offer.getOfferPayload().getReserveTxKeyImages()) xmrWalletService.getWallet().thawOutput(frozenKeyImage); for (String frozenKeyImage : offer.getOfferPayload().getReserveTxKeyImages()) xmrWalletService.getWallet().thawOutput(frozenKeyImage);
} }
@ -571,7 +572,6 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
log.info("onRemoved offerId={}", offer.getId()); log.info("onRemoved offerId={}", offer.getId());
btcWalletService.resetAddressEntriesForOpenOffer(offer.getId()); btcWalletService.resetAddressEntriesForOpenOffer(offer.getId());
requestPersistence(); requestPersistence();
resultHandler.handleResult();
} }
// Close openOffer after deposit published // Close openOffer after deposit published

View File

@ -17,6 +17,7 @@
package bisq.desktop.main.shared; package bisq.desktop.main.shared;
import bisq.common.UserThread;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty; import javafx.beans.property.StringProperty;
@ -38,6 +39,6 @@ public class PriceFeedComboBoxItem {
} }
public void setDisplayString(String displayString) { public void setDisplayString(String displayString) {
this.displayStringProperty.set(displayString); UserThread.execute(() -> this.displayStringProperty.set(displayString));
} }
} }