mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-23 04:29:22 +00:00
thaw reserved outputs within task if canceled
This commit is contained in:
parent
f2f5a6fd24
commit
796603f82b
2 changed files with 27 additions and 15 deletions
|
@ -79,6 +79,7 @@ public class MakerReserveOfferFunds extends Task<PlaceOfferModel> {
|
||||||
Integer preferredSubaddressIndex = fundingEntry == null ? null : fundingEntry.getSubaddressIndex();
|
Integer preferredSubaddressIndex = fundingEntry == null ? null : fundingEntry.getSubaddressIndex();
|
||||||
|
|
||||||
// attempt creating reserve tx
|
// attempt creating reserve tx
|
||||||
|
try {
|
||||||
synchronized (HavenoUtils.getWalletFunctionLock()) {
|
synchronized (HavenoUtils.getWalletFunctionLock()) {
|
||||||
for (int i = 0; i < TradeProtocol.MAX_ATTEMPTS; i++) {
|
for (int i = 0; i < TradeProtocol.MAX_ATTEMPTS; i++) {
|
||||||
try {
|
try {
|
||||||
|
@ -96,6 +97,16 @@ public class MakerReserveOfferFunds extends Task<PlaceOfferModel> {
|
||||||
if (reserveTx != null) break;
|
if (reserveTx != null) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
// reset state with wallet lock
|
||||||
|
model.getXmrWalletService().resetAddressEntriesForOpenOffer(offer.getId());
|
||||||
|
if (reserveTx != null) {
|
||||||
|
model.getXmrWalletService().thawOutputs(HavenoUtils.getInputKeyImages(reserveTx));
|
||||||
|
}
|
||||||
|
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
// reset protocol timeout
|
// reset protocol timeout
|
||||||
model.getProtocol().startTimeoutTimer();
|
model.getProtocol().startTimeoutTimer();
|
||||||
|
|
|
@ -81,7 +81,8 @@ public class TakerReserveTradeFunds extends TradeTask {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
// thaw reserved inputs
|
// reset state with wallet lock
|
||||||
|
model.getXmrWalletService().resetAddressEntriesForTrade(trade.getId());
|
||||||
if (reserveTx != null) {
|
if (reserveTx != null) {
|
||||||
model.getXmrWalletService().thawOutputs(HavenoUtils.getInputKeyImages(reserveTx));
|
model.getXmrWalletService().thawOutputs(HavenoUtils.getInputKeyImages(reserveTx));
|
||||||
trade.getSelf().setReserveTxKeyImages(null);
|
trade.getSelf().setReserveTxKeyImages(null);
|
||||||
|
|
Loading…
Reference in a new issue