Change CChain::FindFork() to take ref

The internal null-guard in FindFork() was removed in favor of adding any missing guards at call sites.
This commit is contained in:
optout
2026-02-03 11:18:01 +01:00
parent 20b58e281a
commit c5eb283bca
8 changed files with 14 additions and 14 deletions

View File

@@ -47,10 +47,9 @@ CBlockLocator GetLocator(const CBlockIndex* index)
return CBlockLocator{LocatorEntries(index)};
}
const CBlockIndex *CChain::FindFork(const CBlockIndex *pindex) const {
if (pindex == nullptr) {
return nullptr;
}
const CBlockIndex* CChain::FindFork(const CBlockIndex& index) const
{
const auto* pindex{&index};
if (pindex->nHeight > Height())
pindex = pindex->GetAncestor(Height());
while (pindex && !Contains(*pindex))