diff options
author | dergoegge <n.goeggi@gmail.com> | 2022-02-20 15:40:36 +0100 |
---|---|---|
committer | dergoegge <n.goeggi@gmail.com> | 2022-04-20 13:33:07 +0200 |
commit | 10b83e2aa3393ef2c942fde7ac86e8cf3ea224c1 (patch) | |
tree | 875c166b8b16f48743d88a626b4e87bb5b60cbee /src/net_processing.cpp | |
parent | a4c55a93ef9277e1043c286120e2417652ee8bbb (diff) |
[net processing] Move block cache state into PeerManagerImpl
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 014b722ea3..9b9b44cb48 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -679,6 +679,14 @@ private: std::chrono::microseconds NextInvToInbounds(std::chrono::microseconds now, std::chrono::seconds average_interval); + + // All of the following cache a recent block, and are protected by cs_most_recent_block + RecursiveMutex cs_most_recent_block; + std::shared_ptr<const CBlock> most_recent_block GUARDED_BY(cs_most_recent_block); + std::shared_ptr<const CBlockHeaderAndShortTxIDs> most_recent_compact_block GUARDED_BY(cs_most_recent_block); + uint256 most_recent_block_hash GUARDED_BY(cs_most_recent_block); + bool fWitnessesPresentInMostRecentCompactBlock GUARDED_BY(cs_most_recent_block){false}; + /** Have we requested this block from a peer */ bool IsBlockRequested(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main); @@ -1613,13 +1621,6 @@ void PeerManagerImpl::BlockDisconnected(const std::shared_ptr<const CBlock> &blo m_recent_confirmed_transactions.reset(); } -// All of the following cache a recent block, and are protected by cs_most_recent_block -static RecursiveMutex cs_most_recent_block; -static std::shared_ptr<const CBlock> most_recent_block GUARDED_BY(cs_most_recent_block); -static std::shared_ptr<const CBlockHeaderAndShortTxIDs> most_recent_compact_block GUARDED_BY(cs_most_recent_block); -static uint256 most_recent_block_hash GUARDED_BY(cs_most_recent_block); -static bool fWitnessesPresentInMostRecentCompactBlock GUARDED_BY(cs_most_recent_block); - /** * Maintain state about the best-seen block and fast-announce a compact block * to compatible peers. |