mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Merge bitcoin/bitcoin#26982: p2p: 25880 fixups (stalling timeout)
b2a1e47744
net_processing: simplify logging statement (Martin Zumsande)6548ba68e8
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. (https://github.com/bitcoin/bitcoin/pull/25880#discussion_r1089217720) - Simplify a logging statement (suggested in https://github.com/bitcoin/bitcoin/pull/25880#discussion_r1013738635) ACKs for top commit: MarcoFalke: review ACKb2a1e47744
🕧 Tree-SHA512: 337f0883bf1c94cc26301a80dfa649093ed1e211ddda1acad8449a2add5be44e5c12d6073c209df9c7aa1edb9da33ec1cfdcb0deafd76178ed78785843e80bc7
This commit is contained in:
commit
37fea41bbf
@ -1845,7 +1845,7 @@ void PeerManagerImpl::BlockConnected(const std::shared_ptr<const CBlock>& pblock
|
||||
if (stalling_timeout != BLOCK_STALLING_TIMEOUT_DEFAULT) {
|
||||
const auto new_timeout = std::max(std::chrono::duration_cast<std::chrono::seconds>(stalling_timeout * 0.85), BLOCK_STALLING_TIMEOUT_DEFAULT);
|
||||
if (m_block_stalling_timeout.compare_exchange_strong(stalling_timeout, new_timeout)) {
|
||||
LogPrint(BCLog::NET, "Decreased stalling timeout to %d seconds\n", new_timeout.count());
|
||||
LogPrint(BCLog::NET, "Decreased stalling timeout to %d seconds\n", count_seconds(new_timeout));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5736,7 +5736,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
|
||||
// bandwidth is insufficient.
|
||||
const auto new_timeout = std::min(2 * stalling_timeout, BLOCK_STALLING_TIMEOUT_MAX);
|
||||
if (stalling_timeout != new_timeout && m_block_stalling_timeout.compare_exchange_strong(stalling_timeout, new_timeout)) {
|
||||
LogPrint(BCLog::NET, "Increased stalling timeout temporarily to %d seconds\n", m_block_stalling_timeout.load().count());
|
||||
LogPrint(BCLog::NET, "Increased stalling timeout temporarily to %d seconds\n", count_seconds(new_timeout));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ class P2PIBDStallingTest(BitcoinTestFramework):
|
||||
|
||||
self.mocktime += 2
|
||||
node.setmocktime(self.mocktime)
|
||||
self.wait_until(lambda: node.num_test_p2p_connections() == NUM_PEERS - 2)
|
||||
self.wait_until(lambda: sum(x.is_connected for x in node.p2ps) == NUM_PEERS - 2)
|
||||
self.wait_until(lambda: self.is_block_requested(peers, stall_block))
|
||||
self.all_sync_send_with_ping(peers)
|
||||
|
||||
@ -128,7 +128,7 @@ class P2PIBDStallingTest(BitcoinTestFramework):
|
||||
|
||||
self.mocktime += 2
|
||||
node.setmocktime(self.mocktime)
|
||||
self.wait_until(lambda: node.num_test_p2p_connections() == NUM_PEERS - 3)
|
||||
self.wait_until(lambda: sum(x.is_connected for x in node.p2ps) == NUM_PEERS - 3)
|
||||
self.wait_until(lambda: self.is_block_requested(peers, stall_block))
|
||||
self.all_sync_send_with_ping(peers)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user