@@ -1247,13 +1247,12 @@ PeerManager::PeerManager(const CChainParams& chainparams, CConnman& connman, Ban
1247
1247
// same probability that we have in the reject filter).
1248
1248
g_recent_confirmed_transactions.reset (new CRollingBloomFilter (48000 , 0.000001 ));
1249
1249
1250
- const Consensus::Params& consensusParams = Params ().GetConsensus ();
1251
1250
// Stale tip checking and peer eviction are on two different timers, but we
1252
1251
// don't want them to get out of sync due to drift in the scheduler, so we
1253
1252
// combine them in one function and schedule at the quicker (peer-eviction)
1254
1253
// timer.
1255
1254
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});
1257
1256
1258
1257
// schedule next run for 10-15 minutes in the future
1259
1258
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_
1344
1343
return ;
1345
1344
nHighestFastAnnounce = pindex->nHeight ;
1346
1345
1347
- bool fWitnessEnabled = IsWitnessEnabled (pindex->pprev , Params () .GetConsensus ());
1346
+ bool fWitnessEnabled = IsWitnessEnabled (pindex->pprev , m_chainparams .GetConsensus ());
1348
1347
uint256 hashBlock (pblock->GetHash ());
1349
1348
1350
1349
{
@@ -1572,7 +1571,7 @@ void static ProcessGetBlockData(CNode& pfrom, const CChainParams& chainparams, c
1572
1571
} // release cs_main before calling ActivateBestChain
1573
1572
if (need_activate_chain) {
1574
1573
BlockValidationState state;
1575
- if (!ActivateBestChain (state, Params () , a_recent_block)) {
1574
+ if (!ActivateBestChain (state, chainparams , a_recent_block)) {
1576
1575
LogPrint (BCLog::NET, " failed to activate chain (%s)\n " , state.ToString ());
1577
1576
}
1578
1577
}
@@ -2786,7 +2785,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
2786
2785
a_recent_block = most_recent_block;
2787
2786
}
2788
2787
BlockValidationState state;
2789
- if (!ActivateBestChain (state, Params () , a_recent_block)) {
2788
+ if (!ActivateBestChain (state, m_chainparams , a_recent_block)) {
2790
2789
LogPrint (BCLog::NET, " failed to activate chain (%s)\n " , state.ToString ());
2791
2790
}
2792
2791
}
@@ -4027,7 +4026,7 @@ void PeerManager::EvictExtraOutboundPeers(int64_t time_in_seconds)
4027
4026
}
4028
4027
}
4029
4028
4030
- void PeerManager::CheckForStaleTipAndEvictPeers (const Consensus::Params &consensusParams )
4029
+ void PeerManager::CheckForStaleTipAndEvictPeers ()
4031
4030
{
4032
4031
LOCK (cs_main);
4033
4032
@@ -4038,7 +4037,7 @@ void PeerManager::CheckForStaleTipAndEvictPeers(const Consensus::Params &consens
4038
4037
if (time_in_seconds > m_stale_tip_check_time) {
4039
4038
// Check whether our tip is stale, and if so, allow using an extra
4040
4039
// 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 () )) {
4042
4041
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);
4043
4042
m_connman.SetTryNewOutboundPeer (true );
4044
4043
} else if (m_connman.GetTryNewOutboundPeer ()) {
@@ -4071,7 +4070,7 @@ class CompareInvMempoolOrder
4071
4070
4072
4071
bool PeerManager::SendMessages (CNode* pto)
4073
4072
{
4074
- const Consensus::Params& consensusParams = Params () .GetConsensus ();
4073
+ const Consensus::Params& consensusParams = m_chainparams .GetConsensus ();
4075
4074
4076
4075
// We must call MaybeDiscourageAndDisconnect first, to ensure that we'll
4077
4076
// disconnect misbehaving peers even before the version handshake is complete.
0 commit comments