diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 7d17147ca..f11affbd1 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3561,7 +3561,9 @@ bool PeerLogicValidation::SendMessages(CNode* pto, std::atomic& interruptM if (state.vBlocksInFlight.size() > 0) { QueuedBlock &queuedBlock = state.vBlocksInFlight.front(); int nOtherPeersWithValidatedDownloads = nPeersWithValidatedDownloads - (state.nBlocksInFlightValidHeaders > 0); - if (nNow > state.nDownloadingSince + consensusParams.nPowTargetSpacing * (BLOCK_DOWNLOAD_TIMEOUT_BASE + BLOCK_DOWNLOAD_TIMEOUT_PER_PEER * nOtherPeersWithValidatedDownloads)) { + // Increase the block downloading timeout for RegTest, as Cryptonight hashing takes more time. + int64_t powTargetSpacing = (consensusParams.nPowTargetSpacing == 20) ? 40 : consensusParams.nPowTargetSpacing; + if (nNow > state.nDownloadingSince + powTargetSpacing * (BLOCK_DOWNLOAD_TIMEOUT_BASE + BLOCK_DOWNLOAD_TIMEOUT_PER_PEER * nOtherPeersWithValidatedDownloads)) { LogPrintf("Timeout downloading block %s from peer=%d, disconnecting\n", queuedBlock.hash.ToString(), pto->GetId()); pto->fDisconnect = true; return true; diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index 951d2483d..a072682ee 100644 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -570,7 +570,8 @@ class CBlockHeader(): self.nNonce = struct.unpack("