mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
merge bitcoin#26982: bitcoin#25880 fixups
This commit is contained in:
parent
a36f8f2a1a
commit
10dc874136
@ -1932,7 +1932,7 @@ void PeerManagerImpl::BlockConnected(const std::shared_ptr<const CBlock>& pblock
|
|||||||
if (stalling_timeout != BLOCK_STALLING_TIMEOUT_DEFAULT) {
|
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);
|
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)) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5883,7 +5883,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
|
|||||||
// bandwidth is insufficient.
|
// bandwidth is insufficient.
|
||||||
const auto new_timeout = std::min(2 * stalling_timeout, BLOCK_STALLING_TIMEOUT_MAX);
|
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)) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ class P2PIBDStallingTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
self.mocktime += 2
|
self.mocktime += 2
|
||||||
node.setmocktime(self.mocktime)
|
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.wait_until(lambda: self.is_block_requested(peers, stall_block))
|
||||||
self.all_sync_send_with_ping(peers)
|
self.all_sync_send_with_ping(peers)
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ class P2PIBDStallingTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
self.mocktime += 2
|
self.mocktime += 2
|
||||||
node.setmocktime(self.mocktime)
|
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.wait_until(lambda: self.is_block_requested(peers, stall_block))
|
||||||
self.all_sync_send_with_ping(peers)
|
self.all_sync_send_with_ping(peers)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user