hemilabs / heminetwork

The hemi network core daemons.
MIT License
72 stars 48 forks source link

tbcd: revisit block header cache #282

Closed marcopeereboom closed 1 month ago

marcopeereboom commented 1 month ago

Summary LRU is too expensive to keep track of hundreds-of-thousands, and certainly too expensive for millions of entries.

Changes This PR replaces the blockheader cache with a simple map. It uses a low-iq eviction strategy that basically is just random. It also lifts the block header cache for testnet3 to 3.5M items which may prove to be too expensive. It roughly translates to 4.5G at runtime if fully used. Mainnet uses about 1G.