merge bitcoin#24543: Move remaining globals into PeerManagerImpl

This commit is contained in:
Kittywhiskers Van Gogh 2024-08-04 12:03:39 +00:00
parent dbe41ea141
commit f6c943922f
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
3 changed files with 478 additions and 476 deletions

File diff suppressed because it is too large Load Diff

View File

@ -127,6 +127,9 @@ public:
virtual void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv, virtual void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv,
const std::chrono::microseconds time_received, const std::atomic<bool>& interruptMsgProc) = 0; const std::chrono::microseconds time_received, const std::atomic<bool>& interruptMsgProc) = 0;
/** This function is used for testing the stale tip eviction logic, see denialofservice_tests.cpp */
virtual void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds) = 0;
virtual bool IsBanned(NodeId pnode) = 0; virtual bool IsBanned(NodeId pnode) = 0;
virtual void EraseObjectRequest(NodeId nodeid, const CInv& inv) = 0; virtual void EraseObjectRequest(NodeId nodeid, const CInv& inv) = 0;

View File

@ -34,8 +34,6 @@ static CService ip(uint32_t i)
return CService(CNetAddr(s), Params().GetDefaultPort()); return CService(CNetAddr(s), Params().GetDefaultPort());
} }
void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds);
BOOST_FIXTURE_TEST_SUITE(denialofservice_tests, TestingSetup) BOOST_FIXTURE_TEST_SUITE(denialofservice_tests, TestingSetup)
// Test eviction of an outbound peer whose chain never advances // Test eviction of an outbound peer whose chain never advances
@ -202,7 +200,7 @@ BOOST_AUTO_TEST_CASE(stale_tip_peer_management)
// Update the last announced block time for the last // Update the last announced block time for the last
// peer, and check that the next newest node gets evicted. // peer, and check that the next newest node gets evicted.
UpdateLastBlockAnnounceTime(vNodes.back()->GetId(), GetTime()); peerLogic->UpdateLastBlockAnnounceTime(vNodes.back()->GetId(), GetTime());
peerLogic->CheckForStaleTipAndEvictPeers(); peerLogic->CheckForStaleTipAndEvictPeers();
for (int i = 0; i < max_outbound_full_relay - 1; ++i) { for (int i = 0; i < max_outbound_full_relay - 1; ++i) {