diff --git a/beacon_node/beacon_chain/src/block_processing.rs b/beacon_node/beacon_chain/src/block_processing.rs index 41e1fb3d36..89c5bfc14d 100644 --- a/beacon_node/beacon_chain/src/block_processing.rs +++ b/beacon_node/beacon_chain/src/block_processing.rs @@ -121,7 +121,7 @@ where // If the parent block was the parent_block, automatically update the canonical head. // // TODO: this is a first-in-best-dressed scenario that is not ideal -- find a solution. - if self.canonical_head().beacon_block_root == parent_block_root { + if self.head().beacon_block_root == parent_block_root { self.update_canonical_head( block.clone(), block_root.clone(), diff --git a/beacon_node/beacon_chain/src/block_production.rs b/beacon_node/beacon_chain/src/block_production.rs index d633b34908..50baf12bac 100644 --- a/beacon_node/beacon_chain/src/block_production.rs +++ b/beacon_node/beacon_chain/src/block_production.rs @@ -33,7 +33,7 @@ where .map_err(|e| e.into())? .ok_or(Error::PresentSlotIsNone)?; - let parent_root = self.canonical_head().beacon_block_root; + let parent_root = self.head().beacon_block_root; let parent_block_reader = self .block_store .get_reader(&parent_root)? diff --git a/beacon_node/beacon_chain/src/canonical_head.rs b/beacon_node/beacon_chain/src/canonical_head.rs index f6ab646a87..121ded7676 100644 --- a/beacon_node/beacon_chain/src/canonical_head.rs +++ b/beacon_node/beacon_chain/src/canonical_head.rs @@ -19,11 +19,11 @@ where new_beacon_state: BeaconState, new_beacon_state_root: Hash256, ) { - let mut canonical_head = self + let mut head = self .canonical_head .write() .expect("CRITICAL: CanonicalHead poisioned."); - canonical_head.update( + head.update( new_beacon_block, new_beacon_block_root, new_beacon_state, @@ -31,7 +31,7 @@ where ); } - pub fn canonical_head(&self) -> RwLockReadGuard { + pub fn head(&self) -> RwLockReadGuard { self.canonical_head .read() .expect("CRITICAL: CanonicalHead poisioned.") diff --git a/beacon_node/beacon_chain/src/dump.rs b/beacon_node/beacon_chain/src/dump.rs index 1f1df9ea26..613534328d 100644 --- a/beacon_node/beacon_chain/src/dump.rs +++ b/beacon_node/beacon_chain/src/dump.rs @@ -25,10 +25,10 @@ where let mut dump = vec![]; let mut last_slot = SlotDump { - beacon_block: self.canonical_head().beacon_block.clone(), - beacon_block_root: self.canonical_head().beacon_block_root, - beacon_state: self.canonical_head().beacon_state.clone(), - beacon_state_root: self.canonical_head().beacon_state_root, + beacon_block: self.head().beacon_block.clone(), + beacon_block_root: self.head().beacon_block_root, + beacon_state: self.head().beacon_state.clone(), + beacon_state_root: self.head().beacon_state_root, }; dump.push(last_slot.clone()); diff --git a/beacon_node/beacon_chain/src/info.rs b/beacon_node/beacon_chain/src/info.rs index eddb2fdb93..109ab9be69 100644 --- a/beacon_node/beacon_chain/src/info.rs +++ b/beacon_node/beacon_chain/src/info.rs @@ -8,7 +8,7 @@ where { pub fn validator_index(&self, pubkey: &PublicKey) -> Option { for (i, validator) in self - .canonical_head() + .head() .beacon_state .validator_registry .iter()