Skip to content

Commit

Permalink
better handle start_height
Browse files Browse the repository at this point in the history
  • Loading branch information
josibake committed Jan 27, 2024
1 parent d72141d commit a8d6fb0
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/index/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,8 @@ static const CBlockIndex* NextSyncBlock(const CBlockIndex* pindex_prev, CChain&

if (!pindex_prev) {
if (start_height > 0) {
auto next_index = chain[start_height];


if (next_index) {
return next_index;
} else {
LogPrintf("IT DOESNT EXIST IN THE MEMORY THINGY YET");
}
};
return chain[start_height];
}
return chain.Genesis();
}

Expand Down Expand Up @@ -179,10 +172,12 @@ void BaseIndex::ThreadSync()
Commit();
break;
}
if (pindex_next->pprev != pindex && !Rewind(pindex, pindex_next->pprev)) {
FatalErrorf("%s: Failed to rewind index %s to a previous chain tip",
__func__, GetName());
return;
if (pindex_next->nHeight != m_start_height) {
if (pindex_next->pprev != pindex && !Rewind(pindex, pindex_next->pprev)) {
FatalErrorf("%s: Failed to rewind index %s to a previous chain tip",
__func__, GetName());
return;
}
}
pindex = pindex_next;
}
Expand Down

0 comments on commit a8d6fb0

Please sign in to comment.