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 3875b5cc..e5d1120f 100644 --- a/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferProtocol.java +++ b/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferProtocol.java @@ -62,12 +62,13 @@ public class PlaceOfferProtocol { public void placeOffer() { - timeoutTimer = UserThread.runAfter(() -> { - handleError(Res.get("createOffer.timeoutAtPublishing")); - }, TradeProtocol.TRADE_TIMEOUT); + startTimeoutTimer(); TaskRunner taskRunner = new TaskRunner<>(model, () -> { + + // reset timer if response not yet received + if (model.getSignOfferResponse() == null) startTimeoutTimer(); }, (errorMessage) -> { handleError(errorMessage); @@ -99,10 +100,7 @@ public class PlaceOfferProtocol { } // reset timer - stopTimeoutTimer(); - timeoutTimer = UserThread.runAfter(() -> { - handleError(Res.get("createOffer.timeoutAtPublishing")); - }, TradeProtocol.TRADE_TIMEOUT); + startTimeoutTimer(); TaskRunner taskRunner = new TaskRunner<>(model, () -> { @@ -130,6 +128,13 @@ public class PlaceOfferProtocol { taskRunner.run(); } + private void startTimeoutTimer() { + stopTimeoutTimer(); + timeoutTimer = UserThread.runAfter(() -> { + handleError(Res.get("createOffer.timeoutAtPublishing")); + }, TradeProtocol.TRADE_TIMEOUT); + } + private void stopTimeoutTimer() { if (timeoutTimer != null) { timeoutTimer.stop();