Skip to content

Commit 43620a4

Browse files
committed
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.
1 parent f022277 commit 43620a4

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

crates/blockchain/src/store.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,7 @@ pub fn update_head(store: &mut Store) -> HeadUpdate {
148148
/// evidence even when live participation has collapsed: exactly the failure
149149
/// mode safe target is supposed to prevent. See leanSpec PR #680.
150150
fn update_safe_target(store: &mut Store) {
151-
let head_state = store
152-
.get_state(&store.head().unwrap())
153-
.expect("head state exists");
154-
let num_validators = head_state.unwrap().validators.len() as u64;
151+
let num_validators = store.head_state().validators.len() as u64;
155152

156153
let min_target_score = (num_validators * 2).div_ceil(3);
157154

0 commit comments

Comments
 (0)