Make some BeaconChain
functions private
This commit is contained in:
parent
5a5eebca06
commit
8acffcc0db
@ -94,7 +94,7 @@ pub struct BeaconChain<T: BeaconChainTypes> {
|
||||
pub op_pool: OperationPool<T::EthSpec>,
|
||||
canonical_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 fork_choice: RwLock<T::ForkChoice>,
|
||||
pub metrics: Metrics,
|
||||
@ -310,7 +310,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
|
||||
/// Update the canonical head to some new values.
|
||||
pub fn update_canonical_head(
|
||||
fn update_canonical_head(
|
||||
&self,
|
||||
new_beacon_block: BeaconBlock,
|
||||
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
|
||||
/// 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() {
|
||||
Ok(Some(slot)) => slot,
|
||||
_ => return Err(Error::UnableToReadSlot),
|
||||
@ -407,7 +407,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
|
||||
/// Update the justified head to some new values.
|
||||
pub fn update_finalized_head(
|
||||
fn update_finalized_head(
|
||||
&self,
|
||||
new_beacon_block: BeaconBlock,
|
||||
new_beacon_block_root: Hash256,
|
||||
|
@ -68,7 +68,7 @@ where
|
||||
info!(
|
||||
log,
|
||||
"Loaded BeaconChain from store";
|
||||
"slot" => beacon_chain.state.read().slot,
|
||||
"slot" => beacon_chain.head().beacon_state.slot,
|
||||
"best_slot" => beacon_chain.best_slot(),
|
||||
);
|
||||
|
||||
|
@ -75,7 +75,7 @@ where
|
||||
// If we don't block here we create an initial scenario where we're unable to process any
|
||||
// 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 slots_since_genesis = beacon_chain.slots_since_genesis().unwrap();
|
||||
info!(
|
||||
@ -91,7 +91,7 @@ where
|
||||
info!(
|
||||
log,
|
||||
"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(),
|
||||
);
|
||||
|
||||
@ -190,7 +190,7 @@ fn do_state_catchup<T: BeaconChainTypes>(chain: &Arc<BeaconChain<T>>, log: &slog
|
||||
"best_slot" => chain.head().beacon_block.slot,
|
||||
"latest_block_root" => format!("{}", chain.head().beacon_block_root),
|
||||
"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,
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user