paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.network/
1.8k stars 652 forks source link

chainHead: Simplify code around the assumptions of the old pruning logic #5605

Open lexnv opened 3 weeks ago

lexnv commented 3 weeks ago

The old pruning logic reported blocks on forks at level (N - 1) compared to the finalized level N. This logic has been changed, and all blocks from other forks should be reported as pruned.

ChainHead contains several places where the pruning logic is guarded for the old algorithm. Refactor the code to remove the old assumptions, for example see this comment: https://github.com/paritytech/polkadot-sdk/pull/5527#discussion_r1742508183