mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-12 07:39:41 +02:00
Change CChain::Next() to take reference
To minimize chance of erroneous nullptr dereference, `CChain::Next()` is changed to take a reference instead of a pointer. Call sites have been adapted. Notably, NextSyncBlock() now checks the FindFork() result before calling into Next(), because the fork lookup may return null.
This commit is contained in:
@@ -4711,7 +4711,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
|
||||
reportDone = percentageDone / 10;
|
||||
}
|
||||
m_notifications.progress(_("Verifying blocks…"), percentageDone, false);
|
||||
pindex = chainstate.m_chain.Next(pindex);
|
||||
pindex = chainstate.m_chain.Next(*pindex);
|
||||
CBlock block;
|
||||
if (!chainstate.m_blockman.ReadBlock(block, *pindex)) {
|
||||
LogError("Verification error: ReadBlock failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
|
||||
Reference in New Issue
Block a user