MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / FindFork

Method FindFork

src/chain/chain.cpp:92–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92CBlockIndex* CChain::FindFork(map<uint256, CBlockIndex *> &mapBlockIndex, const CBlockLocator &locator) const {
93 // Find the first block the caller has in the main chain
94 for (const auto &hash : locator.vHave) {
95 map<uint256, CBlockIndex *>::iterator mi = mapBlockIndex.find(hash);
96 if (mi != mapBlockIndex.end()) {
97 CBlockIndex *pIndex = (*mi).second;
98 if (pIndex && Contains(pIndex))
99 return pIndex;
100 }
101 }
102
103 return Genesis();
104}
105
106////////////////////////////////////////////////////////////////////////////////
107// class CChainActive

Callers 2

ProcessGetHeadersMessageFunction · 0.80
ProcessGetBlocksMessageFunction · 0.80

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected