@@ -311,31 +311,29 @@ pub fn downgrade_from_v24<T: BeaconChainTypes>(
311
311
} ;
312
312
migrate_ops. push ( pruning_checkpoint. as_kv_store_op ( PRUNING_CHECKPOINT_KEY ) ) ;
313
313
314
- // TODO(tree-states): What about the anchor_slot? Is it safe to run the prior version of
315
- // Lighthouse with an a higher anchor_slot than expected?
316
-
314
+ // Convert state summaries back to the old format.
317
315
for ( state_root, summary) in state_summaries_dag
318
316
. summaries_by_slot_ascending ( )
319
317
. into_iter ( )
320
318
. flat_map ( |( _, summaries) | summaries)
321
319
{
322
- // If boundary state persist.
320
+ // If boundary state: persist.
323
321
// Do not cache these states as they are unlikely to be relevant later.
324
322
let update_cache = false ;
325
323
if summary. slot % T :: EthSpec :: slots_per_epoch ( ) == 0 {
326
324
let ( state, _) = db
327
325
. load_hot_state ( & state_root, update_cache) ?
328
326
. ok_or ( Error :: MissingState ( state_root) ) ?;
329
327
330
- // Immediately commit the state. Otherwise we will OOM and it 's stored in a different
331
- // column. So if the migration crashes we just get extra harmless junk in the DB.
328
+ // Immediately commit the state, so we don't OOM. It 's stored in a different
329
+ // column so if the migration crashes we'll just store extra harmless junk in the DB.
332
330
let mut state_write_ops = vec ! [ ] ;
333
331
store_full_state_v22 ( & state_root, & state, & mut state_write_ops) ?;
334
332
db. hot_db . do_atomically ( state_write_ops) ?;
335
333
states_written += 1 ;
336
334
}
337
335
338
- // Persist old summary
336
+ // Persist old summary.
339
337
let epoch_boundary_state_slot = summary. slot - summary. slot % T :: EthSpec :: slots_per_epoch ( ) ;
340
338
let old_summary = HotStateSummaryV22 {
341
339
slot : summary. slot ,
0 commit comments