diff --git a/beacon_node/beacon_chain/src/block_verification.rs b/beacon_node/beacon_chain/src/block_verification.rs index e86ca85bb..145614c4b 100644 --- a/beacon_node/beacon_chain/src/block_verification.rs +++ b/beacon_node/beacon_chain/src/block_verification.rs @@ -838,10 +838,11 @@ impl GossipVerifiedBlock { &fork_choice_read_lock, block, )?; - drop(fork_choice_read_lock); let block_epoch = block.slot().epoch(T::EthSpec::slots_per_epoch()); - let (parent_block, block) = verify_parent_block_is_known(block_root, chain, block)?; + let (parent_block, block) = + verify_parent_block_is_known::(block_root, &fork_choice_read_lock, block)?; + drop(fork_choice_read_lock); // Track the number of skip slots between the block and its parent. metrics::set_gauge( @@ -1775,14 +1776,10 @@ pub fn get_block_root(block: &SignedBeaconBlock) -> Hash256 { #[allow(clippy::type_complexity)] fn verify_parent_block_is_known( block_root: Hash256, - chain: &BeaconChain, + fork_choice_read_lock: &RwLockReadGuard>, block: Arc>, ) -> Result<(ProtoBlock, Arc>), BlockError> { - if let Some(proto_block) = chain - .canonical_head - .fork_choice_read_lock() - .get_block(&block.parent_root()) - { + if let Some(proto_block) = fork_choice_read_lock.get_block(&block.parent_root()) { Ok((proto_block, block)) } else { Err(BlockError::ParentUnknown(RpcBlock::new_without_blobs(