@@ -353,9 +353,10 @@ where
353353
354354 // A configured floor follows the same path as `SetFloor`: verify it,
355355 // then apply a local anchor or fetch the anchor block.
356- if let Some ( finalization) = self . floor . take_pending_anchor ( ) {
356+ if let Some ( ( finalization, prune_archives ) ) = self . floor . take_pending_anchor ( ) {
357357 self . install_floor (
358358 finalization,
359+ prune_archives,
359360 false ,
360361 & mut resolver,
361362 & mut buffer,
@@ -692,9 +693,19 @@ where
692693 let finalization = self . get_finalization_by_height ( height) . await ;
693694 response. send_lossy ( finalization) ;
694695 }
696+ Message :: GetProcessedHeight { response } => {
697+ response. send_lossy ( self . floor . processed_height ( ) ) ;
698+ }
695699 Message :: HintFinalized { height, targets } => {
696- // Skip if finalization is already available locally.
697- if self . get_finalization_by_height ( height) . await . is_some ( ) {
700+ // Skip if height is below the floor.
701+ if height < self . floor . processed_height ( ) {
702+ return ;
703+ }
704+
705+ // Skip if both the finalization and block are already local.
706+ if self . get_finalization_by_height ( height) . await . is_some ( )
707+ && self . get_finalized_block ( height) . await . is_some ( )
708+ {
698709 return ;
699710 }
700711
@@ -743,9 +754,19 @@ where
743754 . ignore ( ) ;
744755 }
745756 }
746- Message :: SetFloor { finalization } => {
747- self . install_floor ( finalization, true , resolver, buffer, application)
748- . await ;
757+ Message :: SetFloor {
758+ finalization,
759+ prune_archives,
760+ } => {
761+ self . install_floor (
762+ finalization,
763+ prune_archives,
764+ true ,
765+ resolver,
766+ buffer,
767+ application,
768+ )
769+ . await ;
749770 }
750771 Message :: Prune { height } => {
751772 // Only allow pruning at or below the current floor.
@@ -991,6 +1012,7 @@ where
9911012 async fn install_floor < Buf , R > (
9921013 & mut self ,
9931014 finalization : Finalization < P :: Scheme , V :: Commitment > ,
1015+ prune_archives : bool ,
9941016 skip_if_superseded : bool ,
9951017 resolver : & mut R ,
9961018 buffer : & mut OptionalBuffer < V , Buf > ,
@@ -1034,7 +1056,7 @@ where
10341056 }
10351057
10361058 if let Some ( block) = self . find_block_by_commitment ( buffer, commitment) . await {
1037- self . floor . await_anchor ( finalization) ;
1059+ self . floor . await_anchor ( finalization, prune_archives ) ;
10381060 assert ! (
10391061 self . apply_floor_anchor( & block, buffer, application, resolver)
10401062 . await
@@ -1047,7 +1069,7 @@ where
10471069 self . pending_acks . clear ( ) ;
10481070
10491071 debug ! ( ?round, ?commitment, "starting fetch for floor block" ) ;
1050- self . floor . await_anchor ( finalization) ;
1072+ self . floor . await_anchor ( finalization, prune_archives ) ;
10511073 self . floor
10521074 . fetch_if_permitted (
10531075 resolver,
@@ -1094,7 +1116,7 @@ where
10941116 existing = %self . floor. processed_height( ) ,
10951117 "floor not updated, at or below existing"
10961118 ) ;
1097- let finalization = self
1119+ let ( finalization, _prune_archives ) = self
10981120 . floor
10991121 . take_pending_anchor ( )
11001122 . expect ( "pending floor anchor missing" ) ;
@@ -1108,7 +1130,7 @@ where
11081130 }
11091131
11101132 let digest = block. digest ( ) ;
1111- let finalization = self
1133+ let ( finalization, prune_archives ) = self
11121134 . floor
11131135 . take_pending_anchor ( )
11141136 . expect ( "pending floor anchor missing" ) ;
@@ -1152,10 +1174,11 @@ where
11521174 // acks for blocks below the new floor cannot rewrite the processed floor.
11531175 self . pending_acks . clear ( ) ;
11541176
1155- // The floor is durable, so cache/finalized data below it can be pruned.
1156- self . prune_after_floor ( height)
1157- . await
1158- . expect ( "failed to prune data below floor" ) ;
1177+ if prune_archives {
1178+ self . prune_after_floor ( height)
1179+ . await
1180+ . expect ( "failed to prune data below floor" ) ;
1181+ }
11591182
11601183 // Intentionally keep existing block subscriptions alive. Canceling
11611184 // waiters can have catastrophic consequences (nodes can get stuck in
@@ -1726,9 +1749,9 @@ where
17261749 finalization : Option < Finalization < P :: Scheme , V :: Commitment > > ,
17271750 application : & mut impl Reporter < Activity = Update < V :: ApplicationBlock , A > > ,
17281751 ) -> bool {
1729- // Blocks below the last processed height are not useful to us, so we ignore them (this
1730- // has the nice byproduct of ensuring we don't call a backing store with a block below the
1731- // pruning boundary)
1752+ // Blocks at or below the last processed height are not useful to us, so we
1753+ // ignore them (this has the nice byproduct of ensuring we don't call
1754+ // a backing store with a block below the pruning boundary).
17321755 if height <= self . floor . processed_height ( ) {
17331756 debug ! (
17341757 %height,
0 commit comments