fix light client data pruning (#3523)
When eliminating orphaned forks, light client data about blocks was also deleted when the orphaned fork was referring to a state several slots after the block. Linking light client data pruning with block deletion instead of state deletion fixes this problem. Light client data always refers to blocks and their immediate post-state.
This commit is contained in:
parent
ca045900c8
commit
04b851f775
|
@ -1252,13 +1252,14 @@ proc pruneBlocksDAG(dag: ChainDAGRef) =
|
|||
|
||||
var cur = head.atSlot()
|
||||
while not cur.blck.isAncestorOf(dag.finalizedHead.blck):
|
||||
# Update light client data
|
||||
dag.deleteLightClientData(cur.blck.bid)
|
||||
|
||||
# TODO: should we move that disk I/O to `onSlotEnd`
|
||||
dag.delState(cur.toBlockSlotId().expect("not nil"))
|
||||
|
||||
if cur.isProposed():
|
||||
# Update light client data
|
||||
dag.deleteLightClientData(cur.blck.bid)
|
||||
|
||||
dag.forkBlocks.excl(KeyedBlockRef.init(cur.blck))
|
||||
dag.db.delBlock(cur.blck.root)
|
||||
|
||||
|
|
Loading…
Reference in New Issue