@@ -1247,13 +1247,12 @@ PeerManager::PeerManager(const CChainParams& chainparams, CConnman& connman, Ban
12471247 // same probability that we have in the reject filter).
12481248 g_recent_confirmed_transactions.reset (new CRollingBloomFilter (48000 , 0.000001 ));
12491249
1250- const Consensus::Params& consensusParams = Params ().GetConsensus ();
12511250 // Stale tip checking and peer eviction are on two different timers, but we
12521251 // don't want them to get out of sync due to drift in the scheduler, so we
12531252 // combine them in one function and schedule at the quicker (peer-eviction)
12541253 // timer.
12551254 static_assert (EXTRA_PEER_CHECK_INTERVAL < STALE_CHECK_INTERVAL, " peer eviction timer should be less than stale tip check timer" );
1256- scheduler.scheduleEvery ([this , consensusParams ] { this ->CheckForStaleTipAndEvictPeers (consensusParams ); }, std::chrono::seconds{EXTRA_PEER_CHECK_INTERVAL});
1255+ scheduler.scheduleEvery ([this ] { this ->CheckForStaleTipAndEvictPeers (); }, std::chrono::seconds{EXTRA_PEER_CHECK_INTERVAL});
12571256
12581257 // schedule next run for 10-15 minutes in the future
12591258 const std::chrono::milliseconds delta = std::chrono::minutes{10 } + GetRandMillis (std::chrono::minutes{5 });
@@ -1344,7 +1343,7 @@ void PeerManager::NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_
13441343 return ;
13451344 nHighestFastAnnounce = pindex->nHeight ;
13461345
1347- bool fWitnessEnabled = IsWitnessEnabled (pindex->pprev , Params () .GetConsensus ());
1346+ bool fWitnessEnabled = IsWitnessEnabled (pindex->pprev , m_chainparams .GetConsensus ());
13481347 uint256 hashBlock (pblock->GetHash ());
13491348
13501349 {
@@ -1572,7 +1571,7 @@ void static ProcessGetBlockData(CNode& pfrom, const CChainParams& chainparams, c
15721571 } // release cs_main before calling ActivateBestChain
15731572 if (need_activate_chain) {
15741573 BlockValidationState state;
1575- if (!ActivateBestChain (state, Params () , a_recent_block)) {
1574+ if (!ActivateBestChain (state, chainparams , a_recent_block)) {
15761575 LogPrint (BCLog::NET, " failed to activate chain (%s)\n " , state.ToString ());
15771576 }
15781577 }
@@ -2786,7 +2785,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
27862785 a_recent_block = most_recent_block;
27872786 }
27882787 BlockValidationState state;
2789- if (!ActivateBestChain (state, Params () , a_recent_block)) {
2788+ if (!ActivateBestChain (state, m_chainparams , a_recent_block)) {
27902789 LogPrint (BCLog::NET, " failed to activate chain (%s)\n " , state.ToString ());
27912790 }
27922791 }
@@ -4027,7 +4026,7 @@ void PeerManager::EvictExtraOutboundPeers(int64_t time_in_seconds)
40274026 }
40284027}
40294028
4030- void PeerManager::CheckForStaleTipAndEvictPeers (const Consensus::Params &consensusParams )
4029+ void PeerManager::CheckForStaleTipAndEvictPeers ()
40314030{
40324031 LOCK (cs_main);
40334032
@@ -4038,7 +4037,7 @@ void PeerManager::CheckForStaleTipAndEvictPeers(const Consensus::Params &consens
40384037 if (time_in_seconds > m_stale_tip_check_time) {
40394038 // Check whether our tip is stale, and if so, allow using an extra
40404039 // outbound peer
4041- if (!fImporting && !fReindex && m_connman.GetNetworkActive () && m_connman.GetUseAddrmanOutgoing () && TipMayBeStale (consensusParams )) {
4040+ if (!fImporting && !fReindex && m_connman.GetNetworkActive () && m_connman.GetUseAddrmanOutgoing () && TipMayBeStale (m_chainparams. GetConsensus () )) {
40424041 LogPrintf (" Potential stale tip detected, will try using extra outbound peer (last tip update: %d seconds ago)\n " , time_in_seconds - g_last_tip_update);
40434042 m_connman.SetTryNewOutboundPeer (true );
40444043 } else if (m_connman.GetTryNewOutboundPeer ()) {
@@ -4071,7 +4070,7 @@ class CompareInvMempoolOrder
40714070
40724071bool PeerManager::SendMessages (CNode* pto)
40734072{
4074- const Consensus::Params& consensusParams = Params () .GetConsensus ();
4073+ const Consensus::Params& consensusParams = m_chainparams .GetConsensus ();
40754074
40764075 // We must call MaybeDiscourageAndDisconnect first, to ensure that we'll
40774076 // disconnect misbehaving peers even before the version handshake is complete.
0 commit comments