mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Merge ab163b0fb5 into merged_master (Bitcoin PR bitcoin/bitcoin#27823)
This commit is contained in:
commit
1a0275f13e
2 changed files with 24 additions and 5 deletions
|
|
@ -500,8 +500,13 @@ bool BlockManager::LoadBlockIndex(ChainstateManager& chainman, const std::option
|
|||
std::sort(vSortedByHeight.begin(), vSortedByHeight.end(),
|
||||
CBlockIndexHeightOnlyComparator());
|
||||
|
||||
CBlockIndex* previous_index{nullptr};
|
||||
for (CBlockIndex* pindex : vSortedByHeight) {
|
||||
if (m_interrupt) return false;
|
||||
if (previous_index && pindex->nHeight > previous_index->nHeight + 1) {
|
||||
return error("%s: block index is non-contiguous, index of height %d missing", __func__, previous_index->nHeight + 1);
|
||||
}
|
||||
previous_index = pindex;
|
||||
pindex->nChainWork = (pindex->pprev ? pindex->pprev->nChainWork : 0) + GetBlockProof(*pindex);
|
||||
pindex->nTimeMax = (pindex->pprev ? std::max(pindex->pprev->nTimeMax, pindex->nTime) : pindex->nTime);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue