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 @@ -264,6 +264,13 @@ void BaseIndex::Sync()
264
264
return ;
265
265
}
266
266
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
+
267
274
// Handle potential reorgs; if the next block's parent doesn't match our current tip,
268
275
// rewind our index state to match the chain and resume from there.
269
276
if (pindex_next->pprev != pindex && !Rewind (pindex, pindex_next->pprev )) {
@@ -415,6 +422,13 @@ void BaseIndex::Sync()
415
422
break ;
416
423
}
417
424
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
+
418
432
// New blocks arrived during sync.
419
433
// Handle potential reorgs; if the next block's parent doesn't match our tip,
420
434
// rewind index state to the correct chain, then resume.
You can’t perform that action at this time.
0 commit comments