p2p: allow BLOCK_STALLING_TIMEOUT_MAX for addnode peers

This commit is contained in:
Jon Atack 2025-03-12 20:26:01 -06:00
parent eb9730ab65
commit 921b89e1d4

View file

@ -5786,7 +5786,9 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
// Detect whether we're stalling
auto stalling_timeout = m_block_stalling_timeout.load();
if (state.m_stalling_since.count() && state.m_stalling_since < current_time - stalling_timeout) {
// Allow more time for addnode peers
const auto adjusted_timeout{pto->IsManualConn() ? BLOCK_STALLING_TIMEOUT_MAX : stalling_timeout};
if (state.m_stalling_since.count() && state.m_stalling_since < current_time - adjusted_timeout) {
// Stalling only triggers when the block download window cannot move. During normal steady state,
// the download window should be much larger than the to-be-downloaded set of blocks, so disconnection
// should only happen during initial block download.