Merge #12951: [doc] Fix comment in FindForkInGlobalIndex

0ef7b40 [doc] Fix comment in FindForkInGlobalIndex (James O'Beirne)

Pull request description:

  The comment erroneously implies that we're searching `chainActive` for the
  first block common to `locator`, but we're using the parameter `chain`.

Tree-SHA512: 42ba0fb378597820bdf1eaff1e3e284097baa312e7dd8448421c8c71aa91c353ea6c840860afcb7725f392431f3134d4feb271b96ab7058a62f84f48e468e714
This commit is contained in:
Wladimir J. van der Laan 2018-04-16 08:37:44 +02:00 committed by pasta
parent 7b091fb99f
commit fbc1bfd1d5
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -283,7 +283,8 @@ namespace {
CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator) CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator)
{ {
// Find the first block the caller has in the main chain // Find the latest block common to locator and chain - we expect that
// locator.vHave is sorted descending by height.
for (const uint256& hash : locator.vHave) { for (const uint256& hash : locator.vHave) {
BlockMap::iterator mi = mapBlockIndex.find(hash); BlockMap::iterator mi = mapBlockIndex.find(hash);
if (mi != mapBlockIndex.end()) if (mi != mapBlockIndex.end())