aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2020-08-25 16:40:21 -0400
committerCarl Dong <contact@carldong.me>2021-01-28 14:15:26 -0500
commitb026e318c39f59a06e29f1b25c7f577e01b25ccb (patch)
treef47575cf7c0ecbd69ae57817cc39a8b2f5fe02c2 /src/net_processing.cpp
parent3664a150ac7547c9336b571557af223d9e31aac9 (diff)
downloadbitcoin-b026e318c39f59a06e29f1b25c7f577e01b25ccb.tar.xz
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.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 6d96ccde63..fb013a0deb 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -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);
}