diff --git a/client/asset/eth/eth.go b/client/asset/eth/eth.go index 8eef685728..665ff534b6 100644 --- a/client/asset/eth/eth.go +++ b/client/asset/eth/eth.go @@ -85,10 +85,12 @@ const ( providersKey = "providers" - // confCheckTimeout is the amount of time allowed to check for - // confirmations. Testing on testnet has shown spikes up to 2.5 - // seconds. This value may need to be adjusted in the future. - confCheckTimeout = 4 * time.Second + // onChainDataFetchTimeout is the max amount of time allocated to fetching + // on-chain data. Testing on testnet has shown spikes up to 2.5 seconds + // (but on internet, with Tor, it could actually take up to 30 seconds easily). + // Setting it to 10 seconds for now until https://github.com/decred/dcrdex/issues/3184 + // is resolved. + onChainDataFetchTimeout = 10 * time.Second // coinIDTakerFoundMakerRedemption is a prefix to identify one of CoinID formats, // see DecodeCoinID func for details. @@ -3347,7 +3349,7 @@ func (w *assetWallet) SwapConfirmations(ctx context.Context, coinID dex.Bytes, c return 0, false, err } - ctx, cancel := context.WithTimeout(ctx, confCheckTimeout) + ctx, cancel := context.WithTimeout(ctx, onChainDataFetchTimeout) defer cancel() swapData, err := w.swap(ctx, secretHash, contractVer) @@ -3700,7 +3702,7 @@ func (eth *ETHWallet) monitorBlocks(ctx context.Context) { // tipChange callback function is invoked and a goroutine is started to check // if any contracts in the findRedemptionQueue are redeemed in the new blocks. func (eth *ETHWallet) checkForNewBlocks(ctx context.Context) { - ctx, cancel := context.WithTimeout(ctx, 2*time.Second) + ctx, cancel := context.WithTimeout(ctx, onChainDataFetchTimeout) defer cancel() bestHdr, err := eth.node.bestHeader(ctx) if err != nil {