@@ -414,14 +414,7 @@ impl<P: Preset> Storage<P> {
414414 if let Some ( ( _, base_state) ) = base_state {
415415 let current_state = Arc :: clone ( state. get_or_init ( || chain_link. state ( store) ) ) ;
416416
417- if base_state. phase ( ) != current_state. phase ( ) {
418- warn_with_peers ! (
419- "Fork boundary detected at slot {state_slot} (base: {:?}, current: {:?}), storing full state instead of delta" ,
420- base_state. phase( ) ,
421- current_state. phase( )
422- ) ;
423- batch. push ( serialize ( StateByBlockRoot ( block_root) , & current_state) ?) ;
424- } else {
417+ if base_state. phase ( ) == current_state. phase ( ) {
425418 let delta = delta (
426419 & base_state,
427420 & Arc :: clone ( state. get_or_init ( || chain_link. state ( store) ) ) ,
@@ -430,6 +423,13 @@ impl<P: Preset> Storage<P> {
430423 StateDeltaByBlockRoot ( block_root) . to_string ( ) ,
431424 bincode:: serialize ( & delta) ?,
432425 ) ) ;
426+ } else {
427+ warn_with_peers ! (
428+ "Fork boundary detected at slot {state_slot} (base: {:?}, current: {:?}), storing full state instead of delta" ,
429+ base_state. phase( ) ,
430+ current_state. phase( )
431+ ) ;
432+ batch. push ( serialize ( StateByBlockRoot ( block_root) , & current_state) ?) ;
433433 }
434434 } else {
435435 warn_with_peers ! (
@@ -1104,7 +1104,7 @@ impl<P: Preset> Storage<P> {
11041104 } ) )
11051105 }
11061106
1107- fn base_epoch_at_state_epoch ( & self , state_epoch : Epoch ) -> Epoch {
1107+ const fn base_epoch_at_state_epoch ( & self , state_epoch : Epoch ) -> Epoch {
11081108 ( state_epoch / self . state_archival_epoch_interval . get ( ) )
11091109 * self . state_archival_epoch_interval . get ( )
11101110 }
0 commit comments