mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-26 15:59:37 -05:00
reset timeout timer on progress creating offer
This commit is contained in:
parent
1df2ab4389
commit
c7b8571842
@ -71,6 +71,9 @@ public class PlaceOfferModel implements Model {
|
||||
private MoneroTxWallet reserveTx;
|
||||
@Setter
|
||||
private SignOfferResponse signOfferResponse;
|
||||
@Setter
|
||||
@Getter
|
||||
protected PlaceOfferProtocol protocol;
|
||||
|
||||
public PlaceOfferModel(OpenOffer openOffer,
|
||||
BigInteger reservedFundsForOffer,
|
||||
|
@ -51,6 +51,7 @@ public class PlaceOfferProtocol {
|
||||
TransactionResultHandler resultHandler,
|
||||
ErrorMessageHandler errorMessageHandler) {
|
||||
this.model = model;
|
||||
this.model.setProtocol(this);
|
||||
this.resultHandler = resultHandler;
|
||||
this.errorMessageHandler = errorMessageHandler;
|
||||
}
|
||||
@ -128,7 +129,7 @@ public class PlaceOfferProtocol {
|
||||
taskRunner.run();
|
||||
}
|
||||
|
||||
private void startTimeoutTimer() {
|
||||
public void startTimeoutTimer() {
|
||||
stopTimeoutTimer();
|
||||
timeoutTimer = UserThread.runAfter(() -> {
|
||||
handleError(Res.get("createOffer.timeoutAtPublishing"));
|
||||
|
@ -64,6 +64,9 @@ public class MakerReserveOfferFunds extends Task<PlaceOfferModel> {
|
||||
throw new RuntimeException("An error has occurred posting offer " + offer.getId() + " causing its subaddress entry to be deleted");
|
||||
}
|
||||
|
||||
// reset protocol timeout
|
||||
model.getProtocol().startTimeoutTimer();
|
||||
|
||||
// collect reserved key images
|
||||
List<String> reservedKeyImages = new ArrayList<String>();
|
||||
for (MoneroOutput input : reserveTx.getInputs()) reservedKeyImages.add(input.getKeyImage().getHex());
|
||||
|
@ -135,12 +135,17 @@ public class MakerSendSignOfferRequest extends Task<PlaceOfferModel> {
|
||||
public void onFault(String errorMessage) {
|
||||
log.warn("Arbitrator unavailable: address={}: {}", arbitratorNodeAddress, errorMessage);
|
||||
excludedArbitrators.add(arbitratorNodeAddress);
|
||||
|
||||
// get alternative arbitrator
|
||||
Arbitrator altArbitrator = DisputeAgentSelection.getRandomArbitrator(model.getArbitratorManager(), excludedArbitrators);
|
||||
if (altArbitrator == null) {
|
||||
errorMessageHandler.handleErrorMessage("Offer " + request.getOfferId() + " could not be signed by any arbitrator");
|
||||
return;
|
||||
}
|
||||
|
||||
// send request to alrernative arbitrator
|
||||
log.info("Using alternative arbitrator {}", altArbitrator.getNodeAddress());
|
||||
model.getProtocol().startTimeoutTimer(); // reset timeout
|
||||
sendSignOfferRequests(request, altArbitrator.getNodeAddress(), excludedArbitrators, resultHandler, errorMessageHandler);
|
||||
}
|
||||
});
|
||||
|
@ -57,7 +57,7 @@ public class TakerReserveTradeFunds extends TradeTask {
|
||||
throw new RuntimeException("An error has occurred taking trade " + trade.getId() + " causing its subaddress entry to be deleted");
|
||||
}
|
||||
|
||||
// extend protocol timeout
|
||||
// reset protocol timeout
|
||||
trade.getProtocol().startTimeout(TradeProtocol.TRADE_TIMEOUT);
|
||||
|
||||
// save process state
|
||||
|
Loading…
Reference in New Issue
Block a user