From ccf2757418647789f469ec3b9edaec2c7de79f59 Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 13 Apr 2024 09:04:23 -0400 Subject: [PATCH] increase trade protocol step timeout to 2m --- .../offer/placeoffer/PlaceOfferProtocol.java | 2 +- .../core/trade/protocol/ArbitratorProtocol.java | 6 +++--- .../trade/protocol/BuyerAsMakerProtocol.java | 4 ++-- .../trade/protocol/BuyerAsTakerProtocol.java | 4 ++-- .../trade/protocol/SellerAsMakerProtocol.java | 4 ++-- .../trade/protocol/SellerAsTakerProtocol.java | 4 ++-- .../core/trade/protocol/TradeProtocol.java | 16 ++++++++-------- .../tasks/MaybeSendSignContractRequest.java | 2 +- .../protocol/tasks/TakerReserveTradeFunds.java | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) 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 c6df81250b..46ead41e01 100644 --- a/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferProtocol.java +++ b/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferProtocol.java @@ -133,7 +133,7 @@ public class PlaceOfferProtocol { stopTimeoutTimer(); timeoutTimer = UserThread.runAfter(() -> { handleError(Res.get("createOffer.timeoutAtPublishing")); - }, TradeProtocol.TRADE_TIMEOUT); + }, TradeProtocol.TRADE_TIMEOUT_SECONDS); } private void stopTimeoutTimer() { diff --git a/core/src/main/java/haveno/core/trade/protocol/ArbitratorProtocol.java b/core/src/main/java/haveno/core/trade/protocol/ArbitratorProtocol.java index 3c39fc7513..4a0f2b7f0f 100644 --- a/core/src/main/java/haveno/core/trade/protocol/ArbitratorProtocol.java +++ b/core/src/main/java/haveno/core/trade/protocol/ArbitratorProtocol.java @@ -59,13 +59,13 @@ public class ArbitratorProtocol extends DisputeProtocol { ArbitratorSendInitTradeOrMultisigRequests.class) .using(new TradeTaskRunner(trade, () -> { - startTimeout(TRADE_TIMEOUT); + startTimeout(TRADE_TIMEOUT_SECONDS); handleTaskRunnerSuccess(peer, message); }, errorMessage -> { handleTaskRunnerFault(peer, message, errorMessage); })) - .withTimeout(TRADE_TIMEOUT)) + .withTimeout(TRADE_TIMEOUT_SECONDS)) .executeTasks(true); awaitTradeLatch(); } @@ -100,7 +100,7 @@ public class ArbitratorProtocol extends DisputeProtocol { errorMessage -> { handleTaskRunnerFault(sender, request, errorMessage); })) - .withTimeout(TRADE_TIMEOUT)) + .withTimeout(TRADE_TIMEOUT_SECONDS)) .executeTasks(true); awaitTradeLatch(); } diff --git a/core/src/main/java/haveno/core/trade/protocol/BuyerAsMakerProtocol.java b/core/src/main/java/haveno/core/trade/protocol/BuyerAsMakerProtocol.java index f2e65a2944..337d92e269 100644 --- a/core/src/main/java/haveno/core/trade/protocol/BuyerAsMakerProtocol.java +++ b/core/src/main/java/haveno/core/trade/protocol/BuyerAsMakerProtocol.java @@ -74,13 +74,13 @@ public class BuyerAsMakerProtocol extends BuyerProtocol implements MakerProtocol MakerSendInitTradeRequest.class) .using(new TradeTaskRunner(trade, () -> { - startTimeout(TRADE_TIMEOUT); + startTimeout(TRADE_TIMEOUT_SECONDS); handleTaskRunnerSuccess(peer, message); }, errorMessage -> { handleTaskRunnerFault(peer, message, errorMessage); })) - .withTimeout(TRADE_TIMEOUT)) + .withTimeout(TRADE_TIMEOUT_SECONDS)) .executeTasks(true); awaitTradeLatch(); } diff --git a/core/src/main/java/haveno/core/trade/protocol/BuyerAsTakerProtocol.java b/core/src/main/java/haveno/core/trade/protocol/BuyerAsTakerProtocol.java index 06f03da427..e45fe25c11 100644 --- a/core/src/main/java/haveno/core/trade/protocol/BuyerAsTakerProtocol.java +++ b/core/src/main/java/haveno/core/trade/protocol/BuyerAsTakerProtocol.java @@ -79,13 +79,13 @@ public class BuyerAsTakerProtocol extends BuyerProtocol implements TakerProtocol TakerSendInitTradeRequestToArbitrator.class) .using(new TradeTaskRunner(trade, () -> { - startTimeout(TRADE_TIMEOUT); + startTimeout(TRADE_TIMEOUT_SECONDS); unlatchTrade(); }, errorMessage -> { handleError(errorMessage); })) - .withTimeout(TRADE_TIMEOUT)) + .withTimeout(TRADE_TIMEOUT_SECONDS)) .executeTasks(true); awaitTradeLatch(); } diff --git a/core/src/main/java/haveno/core/trade/protocol/SellerAsMakerProtocol.java b/core/src/main/java/haveno/core/trade/protocol/SellerAsMakerProtocol.java index 1b0c9c7c60..d0d3d46f6a 100644 --- a/core/src/main/java/haveno/core/trade/protocol/SellerAsMakerProtocol.java +++ b/core/src/main/java/haveno/core/trade/protocol/SellerAsMakerProtocol.java @@ -79,13 +79,13 @@ public class SellerAsMakerProtocol extends SellerProtocol implements MakerProtoc MakerSendInitTradeRequest.class) .using(new TradeTaskRunner(trade, () -> { - startTimeout(TRADE_TIMEOUT); + startTimeout(TRADE_TIMEOUT_SECONDS); handleTaskRunnerSuccess(peer, message); }, errorMessage -> { handleTaskRunnerFault(peer, message, errorMessage); })) - .withTimeout(TRADE_TIMEOUT)) + .withTimeout(TRADE_TIMEOUT_SECONDS)) .executeTasks(true); awaitTradeLatch(); } diff --git a/core/src/main/java/haveno/core/trade/protocol/SellerAsTakerProtocol.java b/core/src/main/java/haveno/core/trade/protocol/SellerAsTakerProtocol.java index 0393d51377..0fd8f07391 100644 --- a/core/src/main/java/haveno/core/trade/protocol/SellerAsTakerProtocol.java +++ b/core/src/main/java/haveno/core/trade/protocol/SellerAsTakerProtocol.java @@ -80,13 +80,13 @@ public class SellerAsTakerProtocol extends SellerProtocol implements TakerProtoc TakerSendInitTradeRequestToArbitrator.class) .using(new TradeTaskRunner(trade, () -> { - startTimeout(TRADE_TIMEOUT); + startTimeout(TRADE_TIMEOUT_SECONDS); unlatchTrade(); }, errorMessage -> { handleError(errorMessage); })) - .withTimeout(TRADE_TIMEOUT)) + .withTimeout(TRADE_TIMEOUT_SECONDS)) .executeTasks(true); awaitTradeLatch(); } diff --git a/core/src/main/java/haveno/core/trade/protocol/TradeProtocol.java b/core/src/main/java/haveno/core/trade/protocol/TradeProtocol.java index d9fc5a24dd..7205ac0033 100644 --- a/core/src/main/java/haveno/core/trade/protocol/TradeProtocol.java +++ b/core/src/main/java/haveno/core/trade/protocol/TradeProtocol.java @@ -93,7 +93,7 @@ import java.util.concurrent.CountDownLatch; @Slf4j public abstract class TradeProtocol implements DecryptedDirectMessageListener, DecryptedMailboxListener { - public static final int TRADE_TIMEOUT = 60; + public static final int TRADE_TIMEOUT_SECONDS = 120; private static final String TIMEOUT_REACHED = "Timeout reached."; protected final ProcessModel processModel; @@ -316,13 +316,13 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D MaybeSendSignContractRequest.class) .using(new TradeTaskRunner(trade, () -> { - startTimeout(TRADE_TIMEOUT); + startTimeout(TRADE_TIMEOUT_SECONDS); handleTaskRunnerSuccess(sender, request); }, errorMessage -> { handleTaskRunnerFault(sender, request, errorMessage); })) - .withTimeout(TRADE_TIMEOUT)) + .withTimeout(TRADE_TIMEOUT_SECONDS)) .executeTasks(true); awaitTradeLatch(); } @@ -354,13 +354,13 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D ProcessSignContractRequest.class) .using(new TradeTaskRunner(trade, () -> { - startTimeout(TRADE_TIMEOUT); + startTimeout(TRADE_TIMEOUT_SECONDS); handleTaskRunnerSuccess(sender, message); }, errorMessage -> { handleTaskRunnerFault(sender, message, errorMessage); })) - .withTimeout(TRADE_TIMEOUT)) // extend timeout + .withTimeout(TRADE_TIMEOUT_SECONDS)) // extend timeout .executeTasks(true); awaitTradeLatch(); } else { @@ -399,13 +399,13 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D ProcessSignContractResponse.class) .using(new TradeTaskRunner(trade, () -> { - startTimeout(TRADE_TIMEOUT); + startTimeout(TRADE_TIMEOUT_SECONDS); handleTaskRunnerSuccess(sender, message); }, errorMessage -> { handleTaskRunnerFault(sender, message, errorMessage); })) - .withTimeout(TRADE_TIMEOUT)) // extend timeout + .withTimeout(TRADE_TIMEOUT_SECONDS)) // extend timeout .executeTasks(true); awaitTradeLatch(); } else { @@ -451,7 +451,7 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D errorMessage -> { handleTaskRunnerFault(sender, response, errorMessage); })) - .withTimeout(TRADE_TIMEOUT)) + .withTimeout(TRADE_TIMEOUT_SECONDS)) .executeTasks(true); awaitTradeLatch(); } diff --git a/core/src/main/java/haveno/core/trade/protocol/tasks/MaybeSendSignContractRequest.java b/core/src/main/java/haveno/core/trade/protocol/tasks/MaybeSendSignContractRequest.java index e8096841c4..4caf2c84b8 100644 --- a/core/src/main/java/haveno/core/trade/protocol/tasks/MaybeSendSignContractRequest.java +++ b/core/src/main/java/haveno/core/trade/protocol/tasks/MaybeSendSignContractRequest.java @@ -92,7 +92,7 @@ public class MaybeSendSignContractRequest extends TradeTask { } // reset protocol timeout - trade.getProtocol().startTimeout(TradeProtocol.TRADE_TIMEOUT); + trade.getProtocol().startTimeout(TradeProtocol.TRADE_TIMEOUT_SECONDS); // collect reserved key images List reservedKeyImages = new ArrayList(); 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 5058af598f..1746556a7e 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 @@ -59,7 +59,7 @@ public class TakerReserveTradeFunds extends TradeTask { for (MoneroOutput input : reserveTx.getInputs()) reservedKeyImages.add(input.getKeyImage().getHex()); // reset protocol timeout - trade.getProtocol().startTimeout(TradeProtocol.TRADE_TIMEOUT); + trade.getProtocol().startTimeout(TradeProtocol.TRADE_TIMEOUT_SECONDS); // save process state processModel.setReserveTx(reserveTx);