Make some BeaconChain functions private

This commit is contained in:
Paul Hauner 2019-05-30 18:38:41 +10:00
parent 5a5eebca06
commit 8acffcc0db
No known key found for this signature in database
GPG Key ID: 5E2CFF9B75FA63DF
3 changed files with 8 additions and 8 deletions

View File

@ -94,7 +94,7 @@ pub struct BeaconChain<T: BeaconChainTypes> {
pub op_pool: OperationPool<T::EthSpec>, pub op_pool: OperationPool<T::EthSpec>,
canonical_head: RwLock<CheckPoint<T::EthSpec>>, canonical_head: RwLock<CheckPoint<T::EthSpec>>,
finalized_head: RwLock<CheckPoint<T::EthSpec>>, finalized_head: RwLock<CheckPoint<T::EthSpec>>,
pub state: RwLock<BeaconState<T::EthSpec>>, state: RwLock<BeaconState<T::EthSpec>>,
pub spec: ChainSpec, pub spec: ChainSpec,
pub fork_choice: RwLock<T::ForkChoice>, pub fork_choice: RwLock<T::ForkChoice>,
pub metrics: Metrics, pub metrics: Metrics,
@ -310,7 +310,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
} }
/// Update the canonical head to some new values. /// Update the canonical head to some new values.
pub fn update_canonical_head( fn update_canonical_head(
&self, &self,
new_beacon_block: BeaconBlock, new_beacon_block: BeaconBlock,
new_beacon_block_root: Hash256, new_beacon_block_root: Hash256,
@ -354,7 +354,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
/// ///
/// Also persists the `BeaconChain` to the store, in the case the client does not exit /// Also persists the `BeaconChain` to the store, in the case the client does not exit
/// gracefully. /// gracefully.
pub fn update_state(&self, mut state: BeaconState<T::EthSpec>) -> Result<(), Error> { fn update_state(&self, mut state: BeaconState<T::EthSpec>) -> Result<(), Error> {
let present_slot = match self.slot_clock.present_slot() { let present_slot = match self.slot_clock.present_slot() {
Ok(Some(slot)) => slot, Ok(Some(slot)) => slot,
_ => return Err(Error::UnableToReadSlot), _ => return Err(Error::UnableToReadSlot),
@ -407,7 +407,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
} }
/// Update the justified head to some new values. /// Update the justified head to some new values.
pub fn update_finalized_head( fn update_finalized_head(
&self, &self,
new_beacon_block: BeaconBlock, new_beacon_block: BeaconBlock,
new_beacon_block_root: Hash256, new_beacon_block_root: Hash256,

View File

@ -68,7 +68,7 @@ where
info!( info!(
log, log,
"Loaded BeaconChain from store"; "Loaded BeaconChain from store";
"slot" => beacon_chain.state.read().slot, "slot" => beacon_chain.head().beacon_state.slot,
"best_slot" => beacon_chain.best_slot(), "best_slot" => beacon_chain.best_slot(),
); );

View File

@ -75,7 +75,7 @@ where
// If we don't block here we create an initial scenario where we're unable to process any // If we don't block here we create an initial scenario where we're unable to process any
// blocks and we're basically useless. // blocks and we're basically useless.
{ {
let state_slot = beacon_chain.state.read().slot; let state_slot = beacon_chain.head().beacon_state.slot;
let wall_clock_slot = beacon_chain.read_slot_clock().unwrap(); let wall_clock_slot = beacon_chain.read_slot_clock().unwrap();
let slots_since_genesis = beacon_chain.slots_since_genesis().unwrap(); let slots_since_genesis = beacon_chain.slots_since_genesis().unwrap();
info!( info!(
@ -91,7 +91,7 @@ where
info!( info!(
log, log,
"State initialized"; "State initialized";
"state_slot" => beacon_chain.state.read().slot, "state_slot" => beacon_chain.head().beacon_state.slot,
"wall_clock_slot" => beacon_chain.read_slot_clock().unwrap(), "wall_clock_slot" => beacon_chain.read_slot_clock().unwrap(),
); );
@ -190,7 +190,7 @@ fn do_state_catchup<T: BeaconChainTypes>(chain: &Arc<BeaconChain<T>>, log: &slog
"best_slot" => chain.head().beacon_block.slot, "best_slot" => chain.head().beacon_block.slot,
"latest_block_root" => format!("{}", chain.head().beacon_block_root), "latest_block_root" => format!("{}", chain.head().beacon_block_root),
"wall_clock_slot" => chain.read_slot_clock().unwrap(), "wall_clock_slot" => chain.read_slot_clock().unwrap(),
"state_slot" => chain.state.read().slot, "state_slot" => chain.head().beacon_state.slot,
"slots_since_genesis" => genesis_height, "slots_since_genesis" => genesis_height,
); );