File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,13 @@ void BaseIndex::Sync()
263
263
return ;
264
264
}
265
265
266
+ // If pindex_next is our first block and we are starting from a custom height,
267
+ // set pindex to be the previous block. This ensures we test that we can still rewind
268
+ // from our custom start height in the event of a reorg.
269
+ if (pindex_next->nHeight == m_start_height && m_start_height > 0 ) {
270
+ pindex = pindex_next->pprev ;
271
+ }
272
+
266
273
// Handle potential reorgs; if the next block's parent doesn't match our current tip,
267
274
// rewind our index state to match the chain and resume from there.
268
275
if (pindex_next->pprev != pindex && !Rewind (pindex, pindex_next->pprev )) {
@@ -414,6 +421,13 @@ void BaseIndex::Sync()
414
421
break ;
415
422
}
416
423
424
+ // If pindex_next is our first block and we are starting from a custom height,
425
+ // set pindex to be the previous block. This ensures we test that we can still rewind
426
+ // from our custom start height in the event of a reorg.
427
+ if (pindex_next->nHeight == m_start_height && m_start_height > 0 ) {
428
+ pindex = pindex_next->pprev ;
429
+ }
430
+
417
431
// New blocks arrived during sync.
418
432
// Handle potential reorgs; if the next block's parent doesn't match our tip,
419
433
// rewind index state to the correct chain, then resume.
You can’t perform that action at this time.
0 commit comments