Add chain.justified_head
This commit is contained in:
parent
b516fd472e
commit
d1ac7c037d
@ -44,4 +44,12 @@ where
|
||||
let state = self.state(present_slot).ok()?;
|
||||
state.get_beacon_proposer_index(slot, &self.spec)
|
||||
}
|
||||
|
||||
pub fn justified_slot(&self) -> u64 {
|
||||
self.justified_head
|
||||
.read()
|
||||
.expect("Justified head poisoned")
|
||||
.beacon_block
|
||||
.slot
|
||||
}
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ pub struct BeaconChain<T: ClientDB + Sized, U: SlotClock> {
|
||||
pub block_graph: BlockGraph,
|
||||
canonical_head: RwLock<CheckPoint>,
|
||||
finalized_head: RwLock<CheckPoint>,
|
||||
justified_head: RwLock<CheckPoint>,
|
||||
pub latest_attestation_targets: RwLock<AttestationTargets>,
|
||||
pub spec: ChainSpec,
|
||||
}
|
||||
@ -110,6 +111,12 @@ where
|
||||
genesis_state.clone(),
|
||||
state_root.clone(),
|
||||
));
|
||||
let justified_head = RwLock::new(CheckPoint::new(
|
||||
genesis_block.clone(),
|
||||
block_root.clone(),
|
||||
genesis_state.clone(),
|
||||
state_root.clone(),
|
||||
));
|
||||
let canonical_head = RwLock::new(CheckPoint::new(
|
||||
genesis_block.clone(),
|
||||
block_root.clone(),
|
||||
@ -124,6 +131,7 @@ where
|
||||
state_store,
|
||||
slot_clock,
|
||||
block_graph,
|
||||
justified_head,
|
||||
finalized_head,
|
||||
canonical_head,
|
||||
latest_attestation_targets,
|
||||
|
Loading…
Reference in New Issue
Block a user