mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-21 07:02:32 +02:00
validation: Move FindForkInGlobalIndex to BlockManager
[META] This commit should be followed up by removing the comments and assertions meant only to show that the change is correct. FindForkInGlobalIndex only acts on BlockManager. Note to reviewers: Since FindForkInGlobalIndex is always called with ::ChainActive() as its first parameter, it is possible to move FindForkInGlobalIndex to CChainState and remove this const CChain& parameter to instead use m_chain. However, it seems like the original intention was for FindForkInGlobalIndex to work with _any_ chain, not just the current active chain. Let me know if this should be changed.
This commit is contained in:
@ -2968,7 +2968,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
LOCK(cs_main);
|
||||
|
||||
// Find the last block the caller has in the main chain
|
||||
const CBlockIndex* pindex = FindForkInGlobalIndex(::ChainActive(), locator);
|
||||
const CBlockIndex* pindex = g_chainman.m_blockman.FindForkInGlobalIndex(::ChainActive(), locator);
|
||||
|
||||
// Send the rest of the chain
|
||||
if (pindex)
|
||||
@ -3088,7 +3088,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
else
|
||||
{
|
||||
// Find the last block the caller has in the main chain
|
||||
pindex = FindForkInGlobalIndex(::ChainActive(), locator);
|
||||
pindex = g_chainman.m_blockman.FindForkInGlobalIndex(::ChainActive(), locator);
|
||||
if (pindex)
|
||||
pindex = ::ChainActive().Next(pindex);
|
||||
}
|
||||
|
Reference in New Issue
Block a user