Rename chain.canonical_head to head

This commit is contained in:
Paul Hauner 2019-01-28 12:58:20 +11:00
parent acf8b79fe9
commit b516fd472e
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6
5 changed files with 10 additions and 10 deletions

View File

@ -121,7 +121,7 @@ where
// If the parent block was the parent_block, automatically update the canonical head. // 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. // 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( self.update_canonical_head(
block.clone(), block.clone(),
block_root.clone(), block_root.clone(),

View File

@ -33,7 +33,7 @@ where
.map_err(|e| e.into())? .map_err(|e| e.into())?
.ok_or(Error::PresentSlotIsNone)?; .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 let parent_block_reader = self
.block_store .block_store
.get_reader(&parent_root)? .get_reader(&parent_root)?

View File

@ -19,11 +19,11 @@ where
new_beacon_state: BeaconState, new_beacon_state: BeaconState,
new_beacon_state_root: Hash256, new_beacon_state_root: Hash256,
) { ) {
let mut canonical_head = self let mut head = self
.canonical_head .canonical_head
.write() .write()
.expect("CRITICAL: CanonicalHead poisioned."); .expect("CRITICAL: CanonicalHead poisioned.");
canonical_head.update( head.update(
new_beacon_block, new_beacon_block,
new_beacon_block_root, new_beacon_block_root,
new_beacon_state, new_beacon_state,
@ -31,7 +31,7 @@ where
); );
} }
pub fn canonical_head(&self) -> RwLockReadGuard<CheckPoint> { pub fn head(&self) -> RwLockReadGuard<CheckPoint> {
self.canonical_head self.canonical_head
.read() .read()
.expect("CRITICAL: CanonicalHead poisioned.") .expect("CRITICAL: CanonicalHead poisioned.")

View File

@ -25,10 +25,10 @@ where
let mut dump = vec![]; let mut dump = vec![];
let mut last_slot = SlotDump { let mut last_slot = SlotDump {
beacon_block: self.canonical_head().beacon_block.clone(), beacon_block: self.head().beacon_block.clone(),
beacon_block_root: self.canonical_head().beacon_block_root, beacon_block_root: self.head().beacon_block_root,
beacon_state: self.canonical_head().beacon_state.clone(), beacon_state: self.head().beacon_state.clone(),
beacon_state_root: self.canonical_head().beacon_state_root, beacon_state_root: self.head().beacon_state_root,
}; };
dump.push(last_slot.clone()); dump.push(last_slot.clone());

View File

@ -8,7 +8,7 @@ where
{ {
pub fn validator_index(&self, pubkey: &PublicKey) -> Option<usize> { pub fn validator_index(&self, pubkey: &PublicKey) -> Option<usize> {
for (i, validator) in self for (i, validator) in self
.canonical_head() .head()
.beacon_state .beacon_state
.validator_registry .validator_registry
.iter() .iter()