lighthouse/beacon_node/beacon_chain
Paul Hauner c11253a82f Remove grandparents from snapshot cache (#2917)
## Issue Addressed

NA

## Proposed Changes

In https://github.com/sigp/lighthouse/pull/2832 we made some changes to the `SnapshotCache` to help deal with the one-block reorgs seen on mainnet (and testnets).

I believe the change in #2832 is good and we should keep it, but I think that in its present form it is causing the `SnapshotCache` to hold onto states that it doesn't need anymore. For example, a skip slot will result in one more `BeaconSnapshot` being stored in the cache.

This PR adds a new type of pruning that happens after a block is inserted to the cache. We will remove any snapshot from the cache that is a *grandparent* of the block being imported. Since we know the grandparent has two valid blocks built atop it, it is not at risk from a one-block re-org. 

## Additional Info

NA
2022-01-14 07:20:55 +00:00
..
src Remove grandparents from snapshot cache (#2917) 2022-01-14 07:20:55 +00:00
tests Add early attester cache (#2872) 2022-01-11 01:35:55 +00:00
Cargo.toml Update to superstruct v0.4.1 (#2886) 2022-01-06 03:14:58 +00:00