From 43620a4f1bbb858a957fc40f9214b77cd89624c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?= <47506558+MegaRedHand@users.noreply.github.com> Date: Thu, 6 Aug 2026 13:15:54 -0300 Subject: [PATCH] refactor(blockchain): use Store::head_state in update_safe_target The accessor already exists and does exactly this get_state(&head()) chain, so the open-coded version was carrying a redundant unwrap for no reason. --- crates/blockchain/src/store.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/blockchain/src/store.rs b/crates/blockchain/src/store.rs index 5f2a4657..47db8e41 100644 --- a/crates/blockchain/src/store.rs +++ b/crates/blockchain/src/store.rs @@ -148,10 +148,7 @@ pub fn update_head(store: &mut Store) -> HeadUpdate { /// evidence even when live participation has collapsed: exactly the failure /// mode safe target is supposed to prevent. See leanSpec PR #680. fn update_safe_target(store: &mut Store) { - let head_state = store - .get_state(&store.head().unwrap()) - .expect("head state exists"); - let num_validators = head_state.unwrap().validators.len() as u64; + let num_validators = store.head_state().validators.len() as u64; let min_target_score = (num_validators * 2).div_ceil(3);