fix pruned backfill summary (fixes #4552) (#4554)

When enabling pruned history mode, the backfill summary as it was
computed with full backfilling may be pruned - don't try to load it on
init
This commit is contained in:
Jacek Sieka 2023-01-26 11:23:17 +01:00 committed by GitHub
parent 03b468c537
commit 968e27bc97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1094,7 +1094,10 @@ proc init*(T: type ChainDAGRef, cfg: RuntimeConfig, db: BeaconChainDB,
dag.backfill = block:
let backfillSlot = db.finalizedBlocks.low.expect("tail at least")
if backfillSlot < dag.tail.slot:
if backfillSlot <= dag.horizon:
# Backfill done, no need to load anything
BeaconBlockSummary()
elif backfillSlot < dag.tail.slot:
let backfillRoot = db.finalizedBlocks.get(backfillSlot).expect(
"low to be loadable")