mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
net_processing: validationinterface: ignore some events for bg chain
This commit is contained in:
parent
fbe0a7d7ca
commit
1fffdd76a1
1 changed files with 17 additions and 11 deletions
|
@ -1917,9 +1917,25 @@ void PeerManagerImpl::BlockConnected(
|
|||
const std::shared_ptr<const CBlock>& pblock,
|
||||
const CBlockIndex* pindex)
|
||||
{
|
||||
m_orphanage.EraseForBlock(*pblock);
|
||||
// Update this for all chainstate roles so that we don't mistakenly see peers
|
||||
// helping us do background IBD as having a stale tip.
|
||||
m_last_tip_update = GetTime<std::chrono::seconds>();
|
||||
|
||||
// In case the dynamic timeout was doubled once or more, reduce it slowly back to its default value
|
||||
auto stalling_timeout = m_block_stalling_timeout.load();
|
||||
Assume(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);
|
||||
if (m_block_stalling_timeout.compare_exchange_strong(stalling_timeout, new_timeout)) {
|
||||
LogPrint(BCLog::NET, "Decreased stalling timeout to %d seconds\n", count_seconds(new_timeout));
|
||||
}
|
||||
}
|
||||
|
||||
if (role == ChainstateRole::BACKGROUND) {
|
||||
return;
|
||||
}
|
||||
m_orphanage.EraseForBlock(*pblock);
|
||||
|
||||
{
|
||||
LOCK(m_recent_confirmed_transactions_mutex);
|
||||
for (const auto& ptx : pblock->vtx) {
|
||||
|
@ -1936,16 +1952,6 @@ void PeerManagerImpl::BlockConnected(
|
|||
m_txrequest.ForgetTxHash(ptx->GetWitnessHash());
|
||||
}
|
||||
}
|
||||
|
||||
// In case the dynamic timeout was doubled once or more, reduce it slowly back to its default value
|
||||
auto stalling_timeout = m_block_stalling_timeout.load();
|
||||
Assume(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);
|
||||
if (m_block_stalling_timeout.compare_exchange_strong(stalling_timeout, new_timeout)) {
|
||||
LogPrint(BCLog::NET, "Decreased stalling timeout to %d seconds\n", count_seconds(new_timeout));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PeerManagerImpl::BlockDisconnected(const std::shared_ptr<const CBlock> &block, const CBlockIndex* pindex)
|
||||
|
|
Loading…
Add table
Reference in a new issue