Skip to content

Commit 37fea41

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#26982: p2p: 25880 fixups (stalling timeout)
b2a1e47 net_processing: simplify logging statement (Martin Zumsande) 6548ba6 test: fix intermittent errors in p2p_ibd_stalling.py (Martin Zumsande) Pull request description: Two small fixups to #25880: - Use `is_connected` instead of `num_test_p2p_connections` to avoid intermittent failures where the p2p MiniNode got disconnected but this info hasn't made it to python yet, so it fails a ping. (bitcoin/bitcoin#25880 (comment)) - Simplify a logging statement (suggested in bitcoin/bitcoin#25880 (comment)) ACKs for top commit: MarcoFalke: review ACK b2a1e47 🕧 Tree-SHA512: 337f0883bf1c94cc26301a80dfa649093ed1e211ddda1acad8449a2add5be44e5c12d6073c209df9c7aa1edb9da33ec1cfdcb0deafd76178ed78785843e80bc7
2 parents 1c8b80f + b2a1e47 commit 37fea41

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/net_processing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ void PeerManagerImpl::BlockConnected(const std::shared_ptr<const CBlock>& pblock
18451845
if (stalling_timeout != BLOCK_STALLING_TIMEOUT_DEFAULT) {
18461846
const auto new_timeout = std::max(std::chrono::duration_cast<std::chrono::seconds>(stalling_timeout * 0.85), BLOCK_STALLING_TIMEOUT_DEFAULT);
18471847
if (m_block_stalling_timeout.compare_exchange_strong(stalling_timeout, new_timeout)) {
1848-
LogPrint(BCLog::NET, "Decreased stalling timeout to %d seconds\n", new_timeout.count());
1848+
LogPrint(BCLog::NET, "Decreased stalling timeout to %d seconds\n", count_seconds(new_timeout));
18491849
}
18501850
}
18511851
}
@@ -5736,7 +5736,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
57365736
// bandwidth is insufficient.
57375737
const auto new_timeout = std::min(2 * stalling_timeout, BLOCK_STALLING_TIMEOUT_MAX);
57385738
if (stalling_timeout != new_timeout && m_block_stalling_timeout.compare_exchange_strong(stalling_timeout, new_timeout)) {
5739-
LogPrint(BCLog::NET, "Increased stalling timeout temporarily to %d seconds\n", m_block_stalling_timeout.load().count());
5739+
LogPrint(BCLog::NET, "Increased stalling timeout temporarily to %d seconds\n", count_seconds(new_timeout));
57405740
}
57415741
return true;
57425742
}

test/functional/p2p_ibd_stalling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def run_test(self):
115115

116116
self.mocktime += 2
117117
node.setmocktime(self.mocktime)
118-
self.wait_until(lambda: node.num_test_p2p_connections() == NUM_PEERS - 2)
118+
self.wait_until(lambda: sum(x.is_connected for x in node.p2ps) == NUM_PEERS - 2)
119119
self.wait_until(lambda: self.is_block_requested(peers, stall_block))
120120
self.all_sync_send_with_ping(peers)
121121

@@ -128,7 +128,7 @@ def run_test(self):
128128

129129
self.mocktime += 2
130130
node.setmocktime(self.mocktime)
131-
self.wait_until(lambda: node.num_test_p2p_connections() == NUM_PEERS - 3)
131+
self.wait_until(lambda: sum(x.is_connected for x in node.p2ps) == NUM_PEERS - 3)
132132
self.wait_until(lambda: self.is_block_requested(peers, stall_block))
133133
self.all_sync_send_with_ping(peers)
134134

0 commit comments

Comments
 (0)