@@ -712,7 +712,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> BackgroundMigrator<E, Ho
712
712
713
713
// Prune all payloads of the canonical finalized blocks
714
714
if store. get_config ( ) . prune_payloads {
715
- Self :: prune_finalized_payloads ( & newly_finalized_blocks, & mut batch) ;
715
+ Self :: prune_finalized_payloads ( new_finalized_slot , & newly_finalized_blocks, & mut batch) ;
716
716
}
717
717
718
718
store. do_atomically_with_block_and_blobs_cache ( batch) ?;
@@ -728,15 +728,17 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> BackgroundMigrator<E, Ho
728
728
}
729
729
730
730
fn prune_finalized_payloads (
731
+ new_finalized_slot : Slot ,
731
732
finalized_blocks : & [ ( Hash256 , Slot ) ] ,
732
733
hot_db_ops : & mut Vec < StoreOp < E > > ,
733
734
) {
734
- for ( block_root, _ ) in finalized_blocks {
735
+ for ( block_root, slot ) in finalized_blocks {
735
736
// Delete the execution payload if payload pruning is enabled. At a skipped slot we may
736
737
// delete the payload for the finalized block itself, but that's OK as we only guarantee
737
- // that payloads are present for slots >= the split slot. The payload fetching code is also
738
- // forgiving of missing payloads.
739
- hot_db_ops. push ( StoreOp :: DeleteExecutionPayload ( * block_root) ) ;
738
+ // that payloads are present for slots >= the split slot.
739
+ if * slot < new_finalized_slot {
740
+ hot_db_ops. push ( StoreOp :: DeleteExecutionPayload ( * block_root) ) ;
741
+ }
740
742
}
741
743
}
742
744
0 commit comments