seller resets address entries on payout published

This commit is contained in:
woodser 2022-10-01 17:43:19 -04:00
parent 58aad5e6ae
commit 139896bced
2 changed files with 6 additions and 2 deletions

View file

@ -251,8 +251,9 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
xmrWalletService.getAddressEntriesForOpenOffer().stream() xmrWalletService.getAddressEntriesForOpenOffer().stream()
.filter(e -> !openOffersIdSet.contains(e.getOfferId())) .filter(e -> !openOffersIdSet.contains(e.getOfferId()))
.forEach(e -> { .forEach(e -> {
log.warn("We found an outdated addressEntry for openOffer {} (openOffers does not contain that " + log.warn("We found an outdated addressEntry with context {} for openOffer {} (openOffers does not contain that " +
"offer), offers.size={}", "offer), offers.size={}",
e.getContext(),
e.getOfferId(), openOffers.size()); e.getOfferId(), openOffers.size());
xmrWalletService.resetAddressEntriesForOpenOffer(e.getOfferId()); xmrWalletService.resetAddressEntriesForOpenOffer(e.getOfferId());
}); });
@ -579,7 +580,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
openOffers.remove(openOffer); openOffers.remove(openOffer);
openOffer.setState(OpenOffer.State.CLOSED); openOffer.setState(OpenOffer.State.CLOSED);
offerBookService.removeOffer(openOffer.getOffer().getOfferPayload(), offerBookService.removeOffer(openOffer.getOffer().getOfferPayload(),
() -> log.trace("Successful removed offer"), () -> log.info("Successfully removed offer {}", offer.getId()),
log::error); log::error);
requestPersistence(); requestPersistence();
}); });

View file

@ -41,6 +41,9 @@ public class SellerPreparePaymentReceivedMessage extends TradeTask {
if (trade.getPayoutTxHex() != null) { if (trade.getPayoutTxHex() != null) {
log.info("Seller verifying, signing, and publishing payout tx"); log.info("Seller verifying, signing, and publishing payout tx");
trade.verifyPayoutTx(trade.getPayoutTxHex(), true, true); trade.verifyPayoutTx(trade.getPayoutTxHex(), true, true);
// mark address entries as available
processModel.getXmrWalletService().resetAddressEntriesForPendingTrade(trade.getId());
} else { } else {
// create unsigned payout tx // create unsigned payout tx