File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -264,6 +264,13 @@ void BaseIndex::Sync()
264264 return ;
265265 }
266266
267+ // If pindex_next is our first block and we are starting from a custom height,
268+ // set pindex to be the previous block. This ensures we test that we can still rewind
269+ // from our custom start height in the event of a reorg.
270+ if (pindex_next->nHeight == m_start_height && m_start_height > 0 ) {
271+ pindex = pindex_next->pprev ;
272+ }
273+
267274 // Handle potential reorgs; if the next block's parent doesn't match our current tip,
268275 // rewind our index state to match the chain and resume from there.
269276 if (pindex_next->pprev != pindex && !Rewind (pindex, pindex_next->pprev )) {
@@ -415,6 +422,13 @@ void BaseIndex::Sync()
415422 break ;
416423 }
417424
425+ // If pindex_next is our first block and we are starting from a custom height,
426+ // set pindex to be the previous block. This ensures we test that we can still rewind
427+ // from our custom start height in the event of a reorg.
428+ if (pindex_next->nHeight == m_start_height && m_start_height > 0 ) {
429+ pindex = pindex_next->pprev ;
430+ }
431+
418432 // New blocks arrived during sync.
419433 // Handle potential reorgs; if the next block's parent doesn't match our tip,
420434 // rewind index state to the correct chain, then resume.
You can’t perform that action at this time.
0 commit comments