@@ -1856,7 +1856,7 @@ inline void static SendBlockTransactions(const CBlock& block, const BlockTransac
1856
1856
connman.PushMessage (&pfrom, msgMaker.Make (nSendFlags, NetMsgType::BLOCKTXN, resp));
1857
1857
}
1858
1858
1859
- static void ProcessHeadersMessage (CNode& pfrom, CConnman& connman, ChainstateManager& chainman, CTxMemPool& mempool, const std::vector<CBlockHeader>& headers, const CChainParams& chainparams , bool via_compact_block)
1859
+ void PeerManager:: ProcessHeadersMessage (CNode& pfrom, const std::vector<CBlockHeader>& headers, bool via_compact_block)
1860
1860
{
1861
1861
const CNetMsgMaker msgMaker (pfrom.GetSendVersion ());
1862
1862
size_t nCount = headers.size ();
@@ -1882,7 +1882,7 @@ static void ProcessHeadersMessage(CNode& pfrom, CConnman& connman, ChainstateMan
1882
1882
// nUnconnectingHeaders gets reset back to 0.
1883
1883
if (!LookupBlockIndex (headers[0 ].hashPrevBlock ) && nCount < MAX_BLOCKS_TO_ANNOUNCE) {
1884
1884
nodestate->nUnconnectingHeaders ++;
1885
- connman .PushMessage (&pfrom, msgMaker.Make (NetMsgType::GETHEADERS, ::ChainActive ().GetLocator (pindexBestHeader), uint256 ()));
1885
+ m_connman .PushMessage (&pfrom, msgMaker.Make (NetMsgType::GETHEADERS, ::ChainActive ().GetLocator (pindexBestHeader), uint256 ()));
1886
1886
LogPrint (BCLog::NET, " received header %s: missing prev block %s, sending getheaders (%d) to end (peer=%d, nUnconnectingHeaders=%d)\n " ,
1887
1887
headers[0 ].GetHash ().ToString (),
1888
1888
headers[0 ].hashPrevBlock .ToString (),
@@ -1916,7 +1916,7 @@ static void ProcessHeadersMessage(CNode& pfrom, CConnman& connman, ChainstateMan
1916
1916
}
1917
1917
1918
1918
BlockValidationState state;
1919
- if (!chainman .ProcessNewBlockHeaders (headers, state, chainparams , &pindexLast)) {
1919
+ if (!m_chainman .ProcessNewBlockHeaders (headers, state, m_chainparams , &pindexLast)) {
1920
1920
if (state.IsInvalid ()) {
1921
1921
MaybePunishNodeForBlock (pfrom.GetId (), state, via_compact_block, " invalid header received" );
1922
1922
return ;
@@ -1947,10 +1947,10 @@ static void ProcessHeadersMessage(CNode& pfrom, CConnman& connman, ChainstateMan
1947
1947
// TODO: optimize: if pindexLast is an ancestor of ::ChainActive().Tip or pindexBestHeader, continue
1948
1948
// from there instead.
1949
1949
LogPrint (BCLog::NET, " more getheaders (%d) to end to peer=%d (startheight:%d)\n " , pindexLast->nHeight , pfrom.GetId (), pfrom.nStartingHeight );
1950
- connman .PushMessage (&pfrom, msgMaker.Make (NetMsgType::GETHEADERS, ::ChainActive ().GetLocator (pindexLast), uint256 ()));
1950
+ m_connman .PushMessage (&pfrom, msgMaker.Make (NetMsgType::GETHEADERS, ::ChainActive ().GetLocator (pindexLast), uint256 ()));
1951
1951
}
1952
1952
1953
- bool fCanDirectFetch = CanDirectFetch (chainparams .GetConsensus ());
1953
+ bool fCanDirectFetch = CanDirectFetch (m_chainparams .GetConsensus ());
1954
1954
// If this set of headers is valid and ends in a block with at least as
1955
1955
// much work as our tip, download as much as possible.
1956
1956
if (fCanDirectFetch && pindexLast->IsValid (BLOCK_VALID_TREE) && ::ChainActive ().Tip ()->nChainWork <= pindexLast->nChainWork ) {
@@ -1960,7 +1960,7 @@ static void ProcessHeadersMessage(CNode& pfrom, CConnman& connman, ChainstateMan
1960
1960
while (pindexWalk && !::ChainActive ().Contains (pindexWalk) && vToFetch.size () <= MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
1961
1961
if (!(pindexWalk->nStatus & BLOCK_HAVE_DATA) &&
1962
1962
!mapBlocksInFlight.count (pindexWalk->GetBlockHash ()) &&
1963
- (!IsWitnessEnabled (pindexWalk->pprev , chainparams .GetConsensus ()) || State (pfrom.GetId ())->fHaveWitness )) {
1963
+ (!IsWitnessEnabled (pindexWalk->pprev , m_chainparams .GetConsensus ()) || State (pfrom.GetId ())->fHaveWitness )) {
1964
1964
// We don't have this block, and it's not yet in flight.
1965
1965
vToFetch.push_back (pindexWalk);
1966
1966
}
@@ -1984,7 +1984,7 @@ static void ProcessHeadersMessage(CNode& pfrom, CConnman& connman, ChainstateMan
1984
1984
}
1985
1985
uint32_t nFetchFlags = GetFetchFlags (pfrom);
1986
1986
vGetData.push_back (CInv (MSG_BLOCK | nFetchFlags, pindex->GetBlockHash ()));
1987
- MarkBlockAsInFlight (mempool , pfrom.GetId (), pindex->GetBlockHash (), pindex);
1987
+ MarkBlockAsInFlight (m_mempool , pfrom.GetId (), pindex->GetBlockHash (), pindex);
1988
1988
LogPrint (BCLog::NET, " Requesting block %s from peer=%d\n " ,
1989
1989
pindex->GetBlockHash ().ToString (), pfrom.GetId ());
1990
1990
}
@@ -1997,7 +1997,7 @@ static void ProcessHeadersMessage(CNode& pfrom, CConnman& connman, ChainstateMan
1997
1997
// In any case, we want to download using a compact block, not a regular one
1998
1998
vGetData[0 ] = CInv (MSG_CMPCT_BLOCK, vGetData[0 ].hash );
1999
1999
}
2000
- connman .PushMessage (&pfrom, msgMaker.Make (NetMsgType::GETDATA, vGetData));
2000
+ m_connman .PushMessage (&pfrom, msgMaker.Make (NetMsgType::GETDATA, vGetData));
2001
2001
}
2002
2002
}
2003
2003
}
@@ -3353,7 +3353,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
3353
3353
// the peer if the header turns out to be for an invalid block.
3354
3354
// Note that if a peer tries to build on an invalid chain, that
3355
3355
// will be detected and the peer will be disconnected/discouraged.
3356
- return ProcessHeadersMessage (pfrom, m_connman, m_chainman, m_mempool, {cmpctblock.header }, m_chainparams , /* via_compact_block=*/ true );
3356
+ return ProcessHeadersMessage (pfrom, {cmpctblock.header }, /* via_compact_block=*/ true );
3357
3357
}
3358
3358
3359
3359
if (fBlockReconstructed ) {
@@ -3496,7 +3496,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
3496
3496
ReadCompactSize (vRecv); // ignore tx count; assume it is 0.
3497
3497
}
3498
3498
3499
- return ProcessHeadersMessage (pfrom, m_connman, m_chainman, m_mempool, headers, m_chainparams , /* via_compact_block=*/ false );
3499
+ return ProcessHeadersMessage (pfrom, headers, /* via_compact_block=*/ false );
3500
3500
}
3501
3501
3502
3502
if (msg_type == NetMsgType::BLOCK)
0 commit comments