increase trade protocol step timeout to 2m

This commit is contained in:
woodser 2024-04-13 09:04:23 -04:00
parent 2ba37d98fe
commit ccf2757418
9 changed files with 22 additions and 22 deletions

View File

@ -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() {

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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<String> reservedKeyImages = new ArrayList<String>();

View File

@ -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);