mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-25 23:39:26 -05:00
reset address entries for open offer on error taking offer
This commit is contained in:
parent
30e199c56e
commit
dffb676f4e
@ -1007,13 +1007,14 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||
xmrWalletService.swapAddressEntryToAvailable(openOffer.getId(), XmrAddressEntry.Context.OFFER_FUNDING); // change funding subaddress in case funded with unsuitable output(s)
|
||||
XmrAddressEntry entry = xmrWalletService.getOrCreateAddressEntry(openOffer.getId(), XmrAddressEntry.Context.OFFER_FUNDING);
|
||||
log.info("Creating split output tx to fund offer {} at subaddress {}", openOffer.getId(), entry.getSubaddressIndex());
|
||||
long startTime = System.currentTimeMillis();
|
||||
MoneroTxWallet splitOutputTx = xmrWalletService.getWallet().createTx(new MoneroTxConfig()
|
||||
.setAccountIndex(0)
|
||||
.setAddress(entry.getAddressString())
|
||||
.setAmount(reserveAmount)
|
||||
.setRelay(true)
|
||||
.setPriority(XmrWalletService.PROTOCOL_FEE_PRIORITY));
|
||||
log.info("Done creating split output tx to fund offer {}", openOffer.getId());
|
||||
log.info("Done creating split output tx to fund offer {} in {} ms", openOffer.getId(), System.currentTimeMillis() - startTime);
|
||||
|
||||
// schedule txs
|
||||
openOffer.setSplitOutputTxHash(splitOutputTx.getHash());
|
||||
|
@ -878,6 +878,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
||||
requestPersistence();
|
||||
}, errorMessage -> {
|
||||
log.warn("Taker error during trade initialization: " + errorMessage);
|
||||
xmrWalletService.resetAddressEntriesForOpenOffer(trade.getId());
|
||||
maybeRemoveTradeOnError(trade);
|
||||
errorMessageHandler.handleErrorMessage(errorMessage);
|
||||
if (takeOfferRequestErrorMessageHandler != null) takeOfferRequestErrorMessageHandler.handleErrorMessage(errorMessage);
|
||||
|
@ -73,10 +73,4 @@ public class BuyerAsTakerProtocol extends BuyerProtocol implements TakerProtocol
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleError(String errorMessage) {
|
||||
trade.getXmrWalletService().resetAddressEntriesForOpenOffer(trade.getId());
|
||||
super.handleError(errorMessage);
|
||||
}
|
||||
}
|
||||
|
@ -74,10 +74,4 @@ public class SellerAsTakerProtocol extends SellerProtocol implements TakerProtoc
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleError(String errorMessage) {
|
||||
trade.getXmrWalletService().resetAddressEntriesForOpenOffer(trade.getId());
|
||||
super.handleError(errorMessage);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user