reset address entries of taker's offer model when done

fixes the "outdated addressEntry" warning
This commit is contained in:
woodser 2022-10-02 14:45:29 -04:00
parent 139896bced
commit 767f4cf8c0
8 changed files with 27 additions and 12 deletions

View File

@ -579,6 +579,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
getOpenOfferById(offer.getId()).ifPresent(openOffer -> { getOpenOfferById(offer.getId()).ifPresent(openOffer -> {
openOffers.remove(openOffer); openOffers.remove(openOffer);
openOffer.setState(OpenOffer.State.CLOSED); openOffer.setState(OpenOffer.State.CLOSED);
xmrWalletService.resetAddressEntriesForOpenOffer(offer.getId());
offerBookService.removeOffer(openOffer.getOffer().getOfferPayload(), offerBookService.removeOffer(openOffer.getOffer().getOfferPayload(),
() -> log.info("Successfully removed offer {}", offer.getId()), () -> log.info("Successfully removed offer {}", offer.getId()),
log::error); log::error);

View File

@ -145,4 +145,10 @@ public class BuyerAsTakerProtocol extends BuyerProtocol implements TakerProtocol
protected void onTradeMessage(TradeMessage message, NodeAddress peer) { protected void onTradeMessage(TradeMessage message, NodeAddress peer) {
super.onTradeMessage(message, peer); super.onTradeMessage(message, peer);
} }
@Override
protected void handleError(String errorMessage) {
trade.getXmrWalletService().resetAddressEntriesForOpenOffer(trade.getId());
super.handleError(errorMessage);
}
} }

View File

@ -138,4 +138,10 @@ public class SellerAsTakerProtocol extends SellerProtocol implements TakerProtoc
protected void onTradeMessage(TradeMessage message, NodeAddress peer) { protected void onTradeMessage(TradeMessage message, NodeAddress peer) {
super.onTradeMessage(message, peer); super.onTradeMessage(message, peer);
} }
@Override
protected void handleError(String errorMessage) {
trade.getXmrWalletService().resetAddressEntriesForOpenOffer(trade.getId());
super.handleError(errorMessage);
}
} }

View File

@ -29,7 +29,7 @@ import bisq.core.trade.messages.SignContractRequest;
import bisq.core.trade.messages.SignContractResponse; import bisq.core.trade.messages.SignContractResponse;
import bisq.core.trade.messages.TradeMessage; import bisq.core.trade.messages.TradeMessage;
import bisq.core.trade.messages.UpdateMultisigRequest; 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.MaybeSendSignContractRequest;
import bisq.core.trade.protocol.tasks.ProcessDepositResponse; import bisq.core.trade.protocol.tasks.ProcessDepositResponse;
import bisq.core.trade.protocol.tasks.ProcessInitMultisigRequest; import bisq.core.trade.protocol.tasks.ProcessInitMultisigRequest;
@ -306,7 +306,7 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
.setup(tasks( .setup(tasks(
// TODO (woodser): validate request // TODO (woodser): validate request
ProcessSignContractResponse.class, ProcessSignContractResponse.class,
MakerRemoveOpenOffer.class) RemoveOffer.class)
.using(new TradeTaskRunner(trade, .using(new TradeTaskRunner(trade,
() -> { () -> {
startTimeout(TRADE_TIMEOUT); startTimeout(TRADE_TIMEOUT);

View File

@ -26,8 +26,8 @@ import lombok.extern.slf4j.Slf4j;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
@Slf4j @Slf4j
public class MakerRemoveOpenOffer extends TradeTask { public class RemoveOffer extends TradeTask {
public MakerRemoveOpenOffer(TaskRunner<Trade> taskHandler, Trade trade) { public RemoveOffer(TaskRunner<Trade> taskHandler, Trade trade) {
super(taskHandler, trade); super(taskHandler, trade);
} }
@ -35,9 +35,11 @@ public class MakerRemoveOpenOffer extends TradeTask {
protected void run() { protected void run() {
try { try {
runInterceptHook(); runInterceptHook();
if (trade instanceof MakerTrade) { if (trade instanceof MakerTrade) {
processModel.getOpenOfferManager().closeOpenOffer(checkNotNull(trade.getOffer())); processModel.getOpenOfferManager().closeOpenOffer(checkNotNull(trade.getOffer()));
} else {
trade.getXmrWalletService().resetAddressEntriesForOpenOffer(trade.getId());
} }
complete(); complete();
@ -45,4 +47,4 @@ public class MakerRemoveOpenOffer extends TradeTask {
failed(t); failed(t);
} }
} }
} }

View File

@ -31,7 +31,7 @@ import bisq.core.trade.protocol.tasks.BuyerPreparePaymentSentMessage;
import bisq.core.trade.protocol.tasks.BuyerProcessPaymentReceivedMessage; import bisq.core.trade.protocol.tasks.BuyerProcessPaymentReceivedMessage;
import bisq.core.trade.protocol.tasks.BuyerSendPaymentSentMessage; import bisq.core.trade.protocol.tasks.BuyerSendPaymentSentMessage;
import bisq.core.trade.protocol.tasks.MakerSetLockTime; 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.SellerPreparePaymentReceivedMessage;
import bisq.core.trade.protocol.tasks.SellerProcessPaymentSentMessage; import bisq.core.trade.protocol.tasks.SellerProcessPaymentSentMessage;
import bisq.core.trade.protocol.tasks.SellerPublishDepositTx; import bisq.core.trade.protocol.tasks.SellerPublishDepositTx;
@ -119,7 +119,7 @@ public class DebugView extends InitializableView<GridPane, Void> {
VerifyPeersAccountAgeWitness.class, VerifyPeersAccountAgeWitness.class,
MakerSetLockTime.class, MakerSetLockTime.class,
MakerRemoveOpenOffer.class, RemoveOffer.class,
ApplyFilter.class, ApplyFilter.class,
BuyerPreparePaymentSentMessage.class, BuyerPreparePaymentSentMessage.class,
@ -154,7 +154,7 @@ public class DebugView extends InitializableView<GridPane, Void> {
MakerSetLockTime.class, MakerSetLockTime.class,
//SellerAsMakerProcessDepositTxMessage.class, //SellerAsMakerProcessDepositTxMessage.class,
MakerRemoveOpenOffer.class, RemoveOffer.class,
//SellerSendsDepositTxAndDelayedPayoutTxMessage.class, //SellerSendsDepositTxAndDelayedPayoutTxMessage.class,
SellerPublishDepositTx.class, SellerPublishDepositTx.class,

View File

@ -292,7 +292,7 @@ class TakeOfferDataModel extends OfferDataModel {
offerBook.removeOffer(checkNotNull(offer)); 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());
} }

View File

@ -849,10 +849,10 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
super.updateItem(newItem, empty); super.updateItem(newItem, empty);
if (!empty && newItem != null) { if (!empty && newItem != null) {
final Trade trade = newItem.getTrade(); final Trade trade = newItem.getTrade();
final NodeAddress tradingPeerNodeAddress = trade.getTradingPeer().getNodeAddress(); final NodeAddress tradingPeerNodeAddress = trade.getTradingPeer() == null ? null : trade.getTradingPeer().getNodeAddress();
int numPastTrades = model.getNumPastTrades(trade); int numPastTrades = model.getNumPastTrades(trade);
String role = Res.get("peerInfoIcon.tooltip.tradePeer"); String role = Res.get("peerInfoIcon.tooltip.tradePeer");
Node peerInfoIcon = new PeerInfoIconTrading(tradingPeerNodeAddress, Node peerInfoIcon = new PeerInfoIconTrading(tradingPeerNodeAddress, // TODO: display maker and taker node addresses for arbitrator
role, role,
numPastTrades, numPastTrades,
privateNotificationManager, privateNotificationManager,