Closed Frozen closed 2 months ago
Here the reasoning for that PR :
Crosslink before an epoch or blocks that have been pruned using snapDB will set exist
to nil
in
https://github.com/harmony-one/harmony/blob/main/node/node_newblock.go#L243
exist, err := node.Blockchain().ReadCrossLink(pending.ShardID(), pending.BlockNum())
This is what happened last time in mainnet when we tried to add a crosslink for a block/epoch we didn't have. Our solution back then was to remove those pending crosslink because we knew they were already processed.
in theory, crosslink already added on s0 chain are all continuous, so we can create a function that check the lastcrosslink (added on chain) and delete the pending crosslink when the block number in the shard to be processed is older.
Fix for crosslink snap db.