diff --git a/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferModel.java b/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferModel.java index 30c4b223..499c3fd1 100644 --- a/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferModel.java +++ b/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferModel.java @@ -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, diff --git a/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferProtocol.java b/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferProtocol.java index e5d1120f..ab8d1fa0 100644 --- a/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferProtocol.java +++ b/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferProtocol.java @@ -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")); diff --git a/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerReserveOfferFunds.java b/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerReserveOfferFunds.java index 73bc8f9c..8628b72e 100644 --- a/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerReserveOfferFunds.java +++ b/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerReserveOfferFunds.java @@ -64,6 +64,9 @@ public class MakerReserveOfferFunds extends Task { 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 reservedKeyImages = new ArrayList(); for (MoneroOutput input : reserveTx.getInputs()) reservedKeyImages.add(input.getKeyImage().getHex()); diff --git a/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerSendSignOfferRequest.java b/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerSendSignOfferRequest.java index 5ac62d45..fd9b65db 100644 --- a/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerSendSignOfferRequest.java +++ b/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerSendSignOfferRequest.java @@ -135,12 +135,17 @@ public class MakerSendSignOfferRequest extends Task { 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); } }); diff --git a/core/src/main/java/haveno/core/trade/protocol/tasks/TakerReserveTradeFunds.java b/core/src/main/java/haveno/core/trade/protocol/tasks/TakerReserveTradeFunds.java index a79cc046..51d7960b 100644 --- a/core/src/main/java/haveno/core/trade/protocol/tasks/TakerReserveTradeFunds.java +++ b/core/src/main/java/haveno/core/trade/protocol/tasks/TakerReserveTradeFunds.java @@ -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