@@ -869,7 +869,7 @@ void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds)
869
869
if (state) state->m_last_block_announcement = time_in_seconds;
870
870
}
871
871
872
- void PeerLogicValidation ::InitializeNode (CNode *pnode) {
872
+ void PeerManager ::InitializeNode (CNode *pnode) {
873
873
CAddress addr = pnode->addr ;
874
874
std::string addrName = pnode->GetAddrName ();
875
875
NodeId nodeid = pnode->GetId ();
@@ -887,7 +887,7 @@ void PeerLogicValidation::InitializeNode(CNode *pnode) {
887
887
}
888
888
}
889
889
890
- void PeerLogicValidation ::ReattemptInitialBroadcast (CScheduler& scheduler) const
890
+ void PeerManager ::ReattemptInitialBroadcast (CScheduler& scheduler) const
891
891
{
892
892
std::map<uint256, uint256> unbroadcast_txids = m_mempool.GetUnbroadcastTxs ();
893
893
@@ -907,7 +907,7 @@ void PeerLogicValidation::ReattemptInitialBroadcast(CScheduler& scheduler) const
907
907
scheduler.scheduleFromNow ([&] { ReattemptInitialBroadcast (scheduler); }, delta);
908
908
}
909
909
910
- void PeerLogicValidation ::FinalizeNode (NodeId nodeid, bool & fUpdateConnectionTime ) {
910
+ void PeerManager ::FinalizeNode (NodeId nodeid, bool & fUpdateConnectionTime ) {
911
911
fUpdateConnectionTime = false ;
912
912
LOCK (cs_main);
913
913
int misbehavior{0 };
@@ -1241,7 +1241,7 @@ static bool BlockRequestAllowed(const CBlockIndex* pindex, const Consensus::Para
1241
1241
(GetBlockProofEquivalentTime (*pindexBestHeader, *pindex, *pindexBestHeader, consensusParams) < STALE_RELAY_AGE_LIMIT);
1242
1242
}
1243
1243
1244
- PeerLogicValidation::PeerLogicValidation (const CChainParams& chainparams, CConnman& connman, BanMan* banman,
1244
+ PeerManager::PeerManager (const CChainParams& chainparams, CConnman& connman, BanMan* banman,
1245
1245
CScheduler& scheduler, ChainstateManager& chainman, CTxMemPool& pool)
1246
1246
: m_chainparams(chainparams),
1247
1247
m_connman(connman),
@@ -1281,7 +1281,7 @@ PeerLogicValidation::PeerLogicValidation(const CChainParams& chainparams, CConnm
1281
1281
* Evict orphan txn pool entries (EraseOrphanTx) based on a newly connected
1282
1282
* block. Also save the time of the last tip update.
1283
1283
*/
1284
- void PeerLogicValidation ::BlockConnected (const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex)
1284
+ void PeerManager ::BlockConnected (const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindex)
1285
1285
{
1286
1286
{
1287
1287
LOCK (g_cs_orphans);
@@ -1325,7 +1325,7 @@ void PeerLogicValidation::BlockConnected(const std::shared_ptr<const CBlock>& pb
1325
1325
}
1326
1326
}
1327
1327
1328
- void PeerLogicValidation ::BlockDisconnected (const std::shared_ptr<const CBlock> &block, const CBlockIndex* pindex)
1328
+ void PeerManager ::BlockDisconnected (const std::shared_ptr<const CBlock> &block, const CBlockIndex* pindex)
1329
1329
{
1330
1330
// To avoid relay problems with transactions that were previously
1331
1331
// confirmed, clear our filter of recently confirmed transactions whenever
@@ -1350,7 +1350,7 @@ static bool fWitnessesPresentInMostRecentCompactBlock GUARDED_BY(cs_most_recent_
1350
1350
* Maintain state about the best-seen block and fast-announce a compact block
1351
1351
* to compatible peers.
1352
1352
*/
1353
- void PeerLogicValidation ::NewPoWValidBlock (const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& pblock) {
1353
+ void PeerManager ::NewPoWValidBlock (const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& pblock) {
1354
1354
std::shared_ptr<const CBlockHeaderAndShortTxIDs> pcmpctblock = std::make_shared<const CBlockHeaderAndShortTxIDs> (*pblock, true );
1355
1355
const CNetMsgMaker msgMaker (PROTOCOL_VERSION);
1356
1356
@@ -1385,7 +1385,7 @@ void PeerLogicValidation::NewPoWValidBlock(const CBlockIndex *pindex, const std:
1385
1385
if (state.fPreferHeaderAndIDs && (!fWitnessEnabled || state.fWantsCmpctWitness ) &&
1386
1386
!PeerHasHeader (&state, pindex) && PeerHasHeader (&state, pindex->pprev )) {
1387
1387
1388
- LogPrint (BCLog::NET, " %s sending header-and-ids %s to peer=%d\n " , " PeerLogicValidation ::NewPoWValidBlock" ,
1388
+ LogPrint (BCLog::NET, " %s sending header-and-ids %s to peer=%d\n " , " PeerManager ::NewPoWValidBlock" ,
1389
1389
hashBlock.ToString (), pnode->GetId ());
1390
1390
m_connman.PushMessage (pnode, msgMaker.Make (NetMsgType::CMPCTBLOCK, *pcmpctblock));
1391
1391
state.pindexBestHeaderSent = pindex;
@@ -1397,7 +1397,7 @@ void PeerLogicValidation::NewPoWValidBlock(const CBlockIndex *pindex, const std:
1397
1397
* Update our best height and announce any block hashes which weren't previously
1398
1398
* in ::ChainActive() to our peers.
1399
1399
*/
1400
- void PeerLogicValidation ::UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload ) {
1400
+ void PeerManager ::UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload ) {
1401
1401
const int nNewHeight = pindexNew->nHeight ;
1402
1402
m_connman.SetBestHeight (nNewHeight);
1403
1403
@@ -1432,7 +1432,7 @@ void PeerLogicValidation::UpdatedBlockTip(const CBlockIndex *pindexNew, const CB
1432
1432
* Handle invalid block rejection and consequent peer discouragement, maintain which
1433
1433
* peers announce compact blocks.
1434
1434
*/
1435
- void PeerLogicValidation ::BlockChecked (const CBlock& block, const BlockValidationState& state) {
1435
+ void PeerManager ::BlockChecked (const CBlock& block, const BlockValidationState& state) {
1436
1436
LOCK (cs_main);
1437
1437
1438
1438
const uint256 hash (block.GetHash ());
@@ -2340,7 +2340,7 @@ static void ProcessGetCFCheckPt(CNode& peer, CDataStream& vRecv, const CChainPar
2340
2340
connman.PushMessage (&peer, std::move (msg));
2341
2341
}
2342
2342
2343
- void PeerLogicValidation ::ProcessMessage (CNode& pfrom, const std::string& msg_type, CDataStream& vRecv,
2343
+ void PeerManager ::ProcessMessage (CNode& pfrom, const std::string& msg_type, CDataStream& vRecv,
2344
2344
const std::chrono::microseconds time_received,
2345
2345
const std::atomic<bool >& interruptMsgProc)
2346
2346
{
@@ -3798,7 +3798,7 @@ void PeerLogicValidation::ProcessMessage(CNode& pfrom, const std::string& msg_ty
3798
3798
return ;
3799
3799
}
3800
3800
3801
- bool PeerLogicValidation ::MaybeDiscourageAndDisconnect (CNode& pnode)
3801
+ bool PeerManager ::MaybeDiscourageAndDisconnect (CNode& pnode)
3802
3802
{
3803
3803
const NodeId peer_id{pnode.GetId ()};
3804
3804
PeerRef peer = GetPeerRef (peer_id);
@@ -3840,7 +3840,7 @@ bool PeerLogicValidation::MaybeDiscourageAndDisconnect(CNode& pnode)
3840
3840
return true ;
3841
3841
}
3842
3842
3843
- bool PeerLogicValidation ::ProcessMessages (CNode* pfrom, std::atomic<bool >& interruptMsgProc)
3843
+ bool PeerManager ::ProcessMessages (CNode* pfrom, std::atomic<bool >& interruptMsgProc)
3844
3844
{
3845
3845
//
3846
3846
// Message format
@@ -3932,7 +3932,7 @@ bool PeerLogicValidation::ProcessMessages(CNode* pfrom, std::atomic<bool>& inter
3932
3932
return fMoreWork ;
3933
3933
}
3934
3934
3935
- void PeerLogicValidation ::ConsiderEviction (CNode& pto, int64_t time_in_seconds)
3935
+ void PeerManager ::ConsiderEviction (CNode& pto, int64_t time_in_seconds)
3936
3936
{
3937
3937
AssertLockHeld (cs_main);
3938
3938
@@ -3985,7 +3985,7 @@ void PeerLogicValidation::ConsiderEviction(CNode& pto, int64_t time_in_seconds)
3985
3985
}
3986
3986
}
3987
3987
3988
- void PeerLogicValidation ::EvictExtraOutboundPeers (int64_t time_in_seconds)
3988
+ void PeerManager ::EvictExtraOutboundPeers (int64_t time_in_seconds)
3989
3989
{
3990
3990
// Check whether we have too many outbound peers
3991
3991
int extra_peers = m_connman.GetExtraOutboundCount ();
@@ -4044,7 +4044,7 @@ void PeerLogicValidation::EvictExtraOutboundPeers(int64_t time_in_seconds)
4044
4044
}
4045
4045
}
4046
4046
4047
- void PeerLogicValidation ::CheckForStaleTipAndEvictPeers (const Consensus::Params &consensusParams)
4047
+ void PeerManager ::CheckForStaleTipAndEvictPeers (const Consensus::Params &consensusParams)
4048
4048
{
4049
4049
LOCK (cs_main);
4050
4050
@@ -4086,7 +4086,7 @@ class CompareInvMempoolOrder
4086
4086
};
4087
4087
}
4088
4088
4089
- bool PeerLogicValidation ::SendMessages (CNode* pto)
4089
+ bool PeerManager ::SendMessages (CNode* pto)
4090
4090
{
4091
4091
const Consensus::Params& consensusParams = Params ().GetConsensus ();
4092
4092
0 commit comments