diff --git a/core/src/main/java/bisq/core/offer/OpenOfferManager.java b/core/src/main/java/bisq/core/offer/OpenOfferManager.java index 99bda59a11..c79b3ed480 100644 --- a/core/src/main/java/bisq/core/offer/OpenOfferManager.java +++ b/core/src/main/java/bisq/core/offer/OpenOfferManager.java @@ -579,6 +579,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe getOpenOfferById(offer.getId()).ifPresent(openOffer -> { openOffers.remove(openOffer); openOffer.setState(OpenOffer.State.CLOSED); + xmrWalletService.resetAddressEntriesForOpenOffer(offer.getId()); offerBookService.removeOffer(openOffer.getOffer().getOfferPayload(), () -> log.info("Successfully removed offer {}", offer.getId()), log::error); diff --git a/core/src/main/java/bisq/core/trade/protocol/BuyerAsTakerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/BuyerAsTakerProtocol.java index 240e5c2470..371cdaf416 100644 --- a/core/src/main/java/bisq/core/trade/protocol/BuyerAsTakerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/BuyerAsTakerProtocol.java @@ -145,4 +145,10 @@ public class BuyerAsTakerProtocol extends BuyerProtocol implements TakerProtocol protected void onTradeMessage(TradeMessage message, NodeAddress peer) { super.onTradeMessage(message, peer); } + + @Override + protected void handleError(String errorMessage) { + trade.getXmrWalletService().resetAddressEntriesForOpenOffer(trade.getId()); + super.handleError(errorMessage); + } } diff --git a/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java b/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java index 2443551838..3131216574 100644 --- a/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/SellerAsTakerProtocol.java @@ -138,4 +138,10 @@ public class SellerAsTakerProtocol extends SellerProtocol implements TakerProtoc protected void onTradeMessage(TradeMessage message, NodeAddress peer) { super.onTradeMessage(message, peer); } + + @Override + protected void handleError(String errorMessage) { + trade.getXmrWalletService().resetAddressEntriesForOpenOffer(trade.getId()); + super.handleError(errorMessage); + } } diff --git a/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java b/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java index f4d358385e..5fe4ca92c0 100644 --- a/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java +++ b/core/src/main/java/bisq/core/trade/protocol/TradeProtocol.java @@ -29,7 +29,7 @@ import bisq.core.trade.messages.SignContractRequest; import bisq.core.trade.messages.SignContractResponse; import bisq.core.trade.messages.TradeMessage; import bisq.core.trade.messages.UpdateMultisigRequest; -import bisq.core.trade.protocol.tasks.MakerRemoveOpenOffer; +import bisq.core.trade.protocol.tasks.RemoveOffer; import bisq.core.trade.protocol.tasks.MaybeSendSignContractRequest; import bisq.core.trade.protocol.tasks.ProcessDepositResponse; import bisq.core.trade.protocol.tasks.ProcessInitMultisigRequest; @@ -306,7 +306,7 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D .setup(tasks( // TODO (woodser): validate request ProcessSignContractResponse.class, - MakerRemoveOpenOffer.class) + RemoveOffer.class) .using(new TradeTaskRunner(trade, () -> { startTimeout(TRADE_TIMEOUT); diff --git a/core/src/main/java/bisq/core/trade/protocol/tasks/MakerRemoveOpenOffer.java b/core/src/main/java/bisq/core/trade/protocol/tasks/RemoveOffer.java similarity index 85% rename from core/src/main/java/bisq/core/trade/protocol/tasks/MakerRemoveOpenOffer.java rename to core/src/main/java/bisq/core/trade/protocol/tasks/RemoveOffer.java index 784eea0218..21e74c2da0 100644 --- a/core/src/main/java/bisq/core/trade/protocol/tasks/MakerRemoveOpenOffer.java +++ b/core/src/main/java/bisq/core/trade/protocol/tasks/RemoveOffer.java @@ -26,8 +26,8 @@ import lombok.extern.slf4j.Slf4j; import static com.google.common.base.Preconditions.checkNotNull; @Slf4j -public class MakerRemoveOpenOffer extends TradeTask { - public MakerRemoveOpenOffer(TaskRunner taskHandler, Trade trade) { +public class RemoveOffer extends TradeTask { + public RemoveOffer(TaskRunner taskHandler, Trade trade) { super(taskHandler, trade); } @@ -35,9 +35,11 @@ public class MakerRemoveOpenOffer extends TradeTask { protected void run() { try { runInterceptHook(); - + if (trade instanceof MakerTrade) { processModel.getOpenOfferManager().closeOpenOffer(checkNotNull(trade.getOffer())); + } else { + trade.getXmrWalletService().resetAddressEntriesForOpenOffer(trade.getId()); } complete(); @@ -45,4 +47,4 @@ public class MakerRemoveOpenOffer extends TradeTask { failed(t); } } -} +} \ No newline at end of file diff --git a/desktop/src/main/java/bisq/desktop/main/debug/DebugView.java b/desktop/src/main/java/bisq/desktop/main/debug/DebugView.java index 76f7171255..718a72195d 100644 --- a/desktop/src/main/java/bisq/desktop/main/debug/DebugView.java +++ b/desktop/src/main/java/bisq/desktop/main/debug/DebugView.java @@ -31,7 +31,7 @@ import bisq.core.trade.protocol.tasks.BuyerPreparePaymentSentMessage; import bisq.core.trade.protocol.tasks.BuyerProcessPaymentReceivedMessage; import bisq.core.trade.protocol.tasks.BuyerSendPaymentSentMessage; import bisq.core.trade.protocol.tasks.MakerSetLockTime; -import bisq.core.trade.protocol.tasks.MakerRemoveOpenOffer; +import bisq.core.trade.protocol.tasks.RemoveOffer; import bisq.core.trade.protocol.tasks.SellerPreparePaymentReceivedMessage; import bisq.core.trade.protocol.tasks.SellerProcessPaymentSentMessage; import bisq.core.trade.protocol.tasks.SellerPublishDepositTx; @@ -119,7 +119,7 @@ public class DebugView extends InitializableView { VerifyPeersAccountAgeWitness.class, MakerSetLockTime.class, - MakerRemoveOpenOffer.class, + RemoveOffer.class, ApplyFilter.class, BuyerPreparePaymentSentMessage.class, @@ -154,7 +154,7 @@ public class DebugView extends InitializableView { MakerSetLockTime.class, //SellerAsMakerProcessDepositTxMessage.class, - MakerRemoveOpenOffer.class, + RemoveOffer.class, //SellerSendsDepositTxAndDelayedPayoutTxMessage.class, SellerPublishDepositTx.class, diff --git a/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java b/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java index 0c6a4d41bb..e8722ad030 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java @@ -292,7 +292,7 @@ class TakeOfferDataModel extends OfferDataModel { offerBook.removeOffer(checkNotNull(offer)); } - //xmrWalletService.resetAddressEntriesForOpenOffer(offer.getId()); // TODO (woodser): this removes address entries for reserved trades before completion. how doesn't this delete the multisig address entry in bisq before completion? + xmrWalletService.resetAddressEntriesForOpenOffer(offer.getId()); } diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java index 2571ba4ece..3b4216c217 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java @@ -849,10 +849,10 @@ public class PendingTradesView extends ActivatableViewAndModel