| 90 | } |
| 91 | |
| 92 | CBlockIndex* 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 |
no test coverage detected