mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04:00
increase trade protocol step timeout to 2m
This commit is contained in:
parent
2ba37d98fe
commit
ccf2757418
@ -133,7 +133,7 @@ public class PlaceOfferProtocol {
|
|||||||
stopTimeoutTimer();
|
stopTimeoutTimer();
|
||||||
timeoutTimer = UserThread.runAfter(() -> {
|
timeoutTimer = UserThread.runAfter(() -> {
|
||||||
handleError(Res.get("createOffer.timeoutAtPublishing"));
|
handleError(Res.get("createOffer.timeoutAtPublishing"));
|
||||||
}, TradeProtocol.TRADE_TIMEOUT);
|
}, TradeProtocol.TRADE_TIMEOUT_SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopTimeoutTimer() {
|
private void stopTimeoutTimer() {
|
||||||
|
@ -59,13 +59,13 @@ public class ArbitratorProtocol extends DisputeProtocol {
|
|||||||
ArbitratorSendInitTradeOrMultisigRequests.class)
|
ArbitratorSendInitTradeOrMultisigRequests.class)
|
||||||
.using(new TradeTaskRunner(trade,
|
.using(new TradeTaskRunner(trade,
|
||||||
() -> {
|
() -> {
|
||||||
startTimeout(TRADE_TIMEOUT);
|
startTimeout(TRADE_TIMEOUT_SECONDS);
|
||||||
handleTaskRunnerSuccess(peer, message);
|
handleTaskRunnerSuccess(peer, message);
|
||||||
},
|
},
|
||||||
errorMessage -> {
|
errorMessage -> {
|
||||||
handleTaskRunnerFault(peer, message, errorMessage);
|
handleTaskRunnerFault(peer, message, errorMessage);
|
||||||
}))
|
}))
|
||||||
.withTimeout(TRADE_TIMEOUT))
|
.withTimeout(TRADE_TIMEOUT_SECONDS))
|
||||||
.executeTasks(true);
|
.executeTasks(true);
|
||||||
awaitTradeLatch();
|
awaitTradeLatch();
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ public class ArbitratorProtocol extends DisputeProtocol {
|
|||||||
errorMessage -> {
|
errorMessage -> {
|
||||||
handleTaskRunnerFault(sender, request, errorMessage);
|
handleTaskRunnerFault(sender, request, errorMessage);
|
||||||
}))
|
}))
|
||||||
.withTimeout(TRADE_TIMEOUT))
|
.withTimeout(TRADE_TIMEOUT_SECONDS))
|
||||||
.executeTasks(true);
|
.executeTasks(true);
|
||||||
awaitTradeLatch();
|
awaitTradeLatch();
|
||||||
}
|
}
|
||||||
|
@ -74,13 +74,13 @@ public class BuyerAsMakerProtocol extends BuyerProtocol implements MakerProtocol
|
|||||||
MakerSendInitTradeRequest.class)
|
MakerSendInitTradeRequest.class)
|
||||||
.using(new TradeTaskRunner(trade,
|
.using(new TradeTaskRunner(trade,
|
||||||
() -> {
|
() -> {
|
||||||
startTimeout(TRADE_TIMEOUT);
|
startTimeout(TRADE_TIMEOUT_SECONDS);
|
||||||
handleTaskRunnerSuccess(peer, message);
|
handleTaskRunnerSuccess(peer, message);
|
||||||
},
|
},
|
||||||
errorMessage -> {
|
errorMessage -> {
|
||||||
handleTaskRunnerFault(peer, message, errorMessage);
|
handleTaskRunnerFault(peer, message, errorMessage);
|
||||||
}))
|
}))
|
||||||
.withTimeout(TRADE_TIMEOUT))
|
.withTimeout(TRADE_TIMEOUT_SECONDS))
|
||||||
.executeTasks(true);
|
.executeTasks(true);
|
||||||
awaitTradeLatch();
|
awaitTradeLatch();
|
||||||
}
|
}
|
||||||
|
@ -79,13 +79,13 @@ public class BuyerAsTakerProtocol extends BuyerProtocol implements TakerProtocol
|
|||||||
TakerSendInitTradeRequestToArbitrator.class)
|
TakerSendInitTradeRequestToArbitrator.class)
|
||||||
.using(new TradeTaskRunner(trade,
|
.using(new TradeTaskRunner(trade,
|
||||||
() -> {
|
() -> {
|
||||||
startTimeout(TRADE_TIMEOUT);
|
startTimeout(TRADE_TIMEOUT_SECONDS);
|
||||||
unlatchTrade();
|
unlatchTrade();
|
||||||
},
|
},
|
||||||
errorMessage -> {
|
errorMessage -> {
|
||||||
handleError(errorMessage);
|
handleError(errorMessage);
|
||||||
}))
|
}))
|
||||||
.withTimeout(TRADE_TIMEOUT))
|
.withTimeout(TRADE_TIMEOUT_SECONDS))
|
||||||
.executeTasks(true);
|
.executeTasks(true);
|
||||||
awaitTradeLatch();
|
awaitTradeLatch();
|
||||||
}
|
}
|
||||||
|
@ -79,13 +79,13 @@ public class SellerAsMakerProtocol extends SellerProtocol implements MakerProtoc
|
|||||||
MakerSendInitTradeRequest.class)
|
MakerSendInitTradeRequest.class)
|
||||||
.using(new TradeTaskRunner(trade,
|
.using(new TradeTaskRunner(trade,
|
||||||
() -> {
|
() -> {
|
||||||
startTimeout(TRADE_TIMEOUT);
|
startTimeout(TRADE_TIMEOUT_SECONDS);
|
||||||
handleTaskRunnerSuccess(peer, message);
|
handleTaskRunnerSuccess(peer, message);
|
||||||
},
|
},
|
||||||
errorMessage -> {
|
errorMessage -> {
|
||||||
handleTaskRunnerFault(peer, message, errorMessage);
|
handleTaskRunnerFault(peer, message, errorMessage);
|
||||||
}))
|
}))
|
||||||
.withTimeout(TRADE_TIMEOUT))
|
.withTimeout(TRADE_TIMEOUT_SECONDS))
|
||||||
.executeTasks(true);
|
.executeTasks(true);
|
||||||
awaitTradeLatch();
|
awaitTradeLatch();
|
||||||
}
|
}
|
||||||
|
@ -80,13 +80,13 @@ public class SellerAsTakerProtocol extends SellerProtocol implements TakerProtoc
|
|||||||
TakerSendInitTradeRequestToArbitrator.class)
|
TakerSendInitTradeRequestToArbitrator.class)
|
||||||
.using(new TradeTaskRunner(trade,
|
.using(new TradeTaskRunner(trade,
|
||||||
() -> {
|
() -> {
|
||||||
startTimeout(TRADE_TIMEOUT);
|
startTimeout(TRADE_TIMEOUT_SECONDS);
|
||||||
unlatchTrade();
|
unlatchTrade();
|
||||||
},
|
},
|
||||||
errorMessage -> {
|
errorMessage -> {
|
||||||
handleError(errorMessage);
|
handleError(errorMessage);
|
||||||
}))
|
}))
|
||||||
.withTimeout(TRADE_TIMEOUT))
|
.withTimeout(TRADE_TIMEOUT_SECONDS))
|
||||||
.executeTasks(true);
|
.executeTasks(true);
|
||||||
awaitTradeLatch();
|
awaitTradeLatch();
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ import java.util.concurrent.CountDownLatch;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class TradeProtocol implements DecryptedDirectMessageListener, DecryptedMailboxListener {
|
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.";
|
private static final String TIMEOUT_REACHED = "Timeout reached.";
|
||||||
|
|
||||||
protected final ProcessModel processModel;
|
protected final ProcessModel processModel;
|
||||||
@ -316,13 +316,13 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
|
|||||||
MaybeSendSignContractRequest.class)
|
MaybeSendSignContractRequest.class)
|
||||||
.using(new TradeTaskRunner(trade,
|
.using(new TradeTaskRunner(trade,
|
||||||
() -> {
|
() -> {
|
||||||
startTimeout(TRADE_TIMEOUT);
|
startTimeout(TRADE_TIMEOUT_SECONDS);
|
||||||
handleTaskRunnerSuccess(sender, request);
|
handleTaskRunnerSuccess(sender, request);
|
||||||
},
|
},
|
||||||
errorMessage -> {
|
errorMessage -> {
|
||||||
handleTaskRunnerFault(sender, request, errorMessage);
|
handleTaskRunnerFault(sender, request, errorMessage);
|
||||||
}))
|
}))
|
||||||
.withTimeout(TRADE_TIMEOUT))
|
.withTimeout(TRADE_TIMEOUT_SECONDS))
|
||||||
.executeTasks(true);
|
.executeTasks(true);
|
||||||
awaitTradeLatch();
|
awaitTradeLatch();
|
||||||
}
|
}
|
||||||
@ -354,13 +354,13 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
|
|||||||
ProcessSignContractRequest.class)
|
ProcessSignContractRequest.class)
|
||||||
.using(new TradeTaskRunner(trade,
|
.using(new TradeTaskRunner(trade,
|
||||||
() -> {
|
() -> {
|
||||||
startTimeout(TRADE_TIMEOUT);
|
startTimeout(TRADE_TIMEOUT_SECONDS);
|
||||||
handleTaskRunnerSuccess(sender, message);
|
handleTaskRunnerSuccess(sender, message);
|
||||||
},
|
},
|
||||||
errorMessage -> {
|
errorMessage -> {
|
||||||
handleTaskRunnerFault(sender, message, errorMessage);
|
handleTaskRunnerFault(sender, message, errorMessage);
|
||||||
}))
|
}))
|
||||||
.withTimeout(TRADE_TIMEOUT)) // extend timeout
|
.withTimeout(TRADE_TIMEOUT_SECONDS)) // extend timeout
|
||||||
.executeTasks(true);
|
.executeTasks(true);
|
||||||
awaitTradeLatch();
|
awaitTradeLatch();
|
||||||
} else {
|
} else {
|
||||||
@ -399,13 +399,13 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
|
|||||||
ProcessSignContractResponse.class)
|
ProcessSignContractResponse.class)
|
||||||
.using(new TradeTaskRunner(trade,
|
.using(new TradeTaskRunner(trade,
|
||||||
() -> {
|
() -> {
|
||||||
startTimeout(TRADE_TIMEOUT);
|
startTimeout(TRADE_TIMEOUT_SECONDS);
|
||||||
handleTaskRunnerSuccess(sender, message);
|
handleTaskRunnerSuccess(sender, message);
|
||||||
},
|
},
|
||||||
errorMessage -> {
|
errorMessage -> {
|
||||||
handleTaskRunnerFault(sender, message, errorMessage);
|
handleTaskRunnerFault(sender, message, errorMessage);
|
||||||
}))
|
}))
|
||||||
.withTimeout(TRADE_TIMEOUT)) // extend timeout
|
.withTimeout(TRADE_TIMEOUT_SECONDS)) // extend timeout
|
||||||
.executeTasks(true);
|
.executeTasks(true);
|
||||||
awaitTradeLatch();
|
awaitTradeLatch();
|
||||||
} else {
|
} else {
|
||||||
@ -451,7 +451,7 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
|
|||||||
errorMessage -> {
|
errorMessage -> {
|
||||||
handleTaskRunnerFault(sender, response, errorMessage);
|
handleTaskRunnerFault(sender, response, errorMessage);
|
||||||
}))
|
}))
|
||||||
.withTimeout(TRADE_TIMEOUT))
|
.withTimeout(TRADE_TIMEOUT_SECONDS))
|
||||||
.executeTasks(true);
|
.executeTasks(true);
|
||||||
awaitTradeLatch();
|
awaitTradeLatch();
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ public class MaybeSendSignContractRequest extends TradeTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reset protocol timeout
|
// reset protocol timeout
|
||||||
trade.getProtocol().startTimeout(TradeProtocol.TRADE_TIMEOUT);
|
trade.getProtocol().startTimeout(TradeProtocol.TRADE_TIMEOUT_SECONDS);
|
||||||
|
|
||||||
// collect reserved key images
|
// collect reserved key images
|
||||||
List<String> reservedKeyImages = new ArrayList<String>();
|
List<String> reservedKeyImages = new ArrayList<String>();
|
||||||
|
@ -59,7 +59,7 @@ public class TakerReserveTradeFunds extends TradeTask {
|
|||||||
for (MoneroOutput input : reserveTx.getInputs()) reservedKeyImages.add(input.getKeyImage().getHex());
|
for (MoneroOutput input : reserveTx.getInputs()) reservedKeyImages.add(input.getKeyImage().getHex());
|
||||||
|
|
||||||
// reset protocol timeout
|
// reset protocol timeout
|
||||||
trade.getProtocol().startTimeout(TradeProtocol.TRADE_TIMEOUT);
|
trade.getProtocol().startTimeout(TradeProtocol.TRADE_TIMEOUT_SECONDS);
|
||||||
|
|
||||||
// save process state
|
// save process state
|
||||||
processModel.setReserveTx(reserveTx);
|
processModel.setReserveTx(reserveTx);
|
||||||
|
Loading…
Reference in New Issue
Block a user