Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 1,339 Lines • ▼ Show 20 Lines | return pindex->IsValid(BlockValidity::SCRIPTS) && | ||||
(pindexBestHeader != nullptr) && | (pindexBestHeader != nullptr) && | ||||
(pindexBestHeader->GetBlockTime() - pindex->GetBlockTime() < | (pindexBestHeader->GetBlockTime() - pindex->GetBlockTime() < | ||||
STALE_RELAY_AGE_LIMIT) && | STALE_RELAY_AGE_LIMIT) && | ||||
(GetBlockProofEquivalentTime(*pindexBestHeader, *pindex, | (GetBlockProofEquivalentTime(*pindexBestHeader, *pindex, | ||||
*pindexBestHeader, consensusParams) < | *pindexBestHeader, consensusParams) < | ||||
STALE_RELAY_AGE_LIMIT); | STALE_RELAY_AGE_LIMIT); | ||||
} | } | ||||
PeerLogicValidation::PeerLogicValidation(CConnman *connmanIn, BanMan *banman, | PeerLogicValidation::PeerLogicValidation(CConnman *connmanIn, BanMan *banman) | ||||
CScheduler &scheduler) | |||||
: connman(connmanIn), m_banman(banman), m_stale_tip_check_time(0) { | : connman(connmanIn), m_banman(banman), m_stale_tip_check_time(0) { | ||||
// Initialize global variables that cannot be constructed at startup. | // Initialize global variables that cannot be constructed at startup. | ||||
recentRejects.reset(new CRollingBloomFilter(120000, 0.000001)); | recentRejects.reset(new CRollingBloomFilter(120000, 0.000001)); | ||||
} | |||||
void PeerLogicValidation::Start(CScheduler &scheduler) { | |||||
const Consensus::Params &consensusParams = Params().GetConsensus(); | const Consensus::Params &consensusParams = Params().GetConsensus(); | ||||
// Stale tip checking and peer eviction are on two different timers, but we | // Stale tip checking and peer eviction are on two different timers, but we | ||||
// don't want them to get out of sync due to drift in the scheduler, so we | // don't want them to get out of sync due to drift in the scheduler, so we | ||||
// combine them in one function and schedule at the quicker (peer-eviction) | // combine them in one function and schedule at the quicker (peer-eviction) | ||||
// timer. | // timer. | ||||
static_assert( | static_assert( | ||||
EXTRA_PEER_CHECK_INTERVAL < STALE_CHECK_INTERVAL, | EXTRA_PEER_CHECK_INTERVAL < STALE_CHECK_INTERVAL, | ||||
"peer eviction timer should be less than stale tip check timer"); | "peer eviction timer should be less than stale tip check timer"); | ||||
▲ Show 20 Lines • Show All 3,880 Lines • Show Last 20 Lines |