pub fn root_at_slot_from_state(
        &self,
        target_slot: Slot,
        beacon_block_root: Hash256,
        state: &BeaconState<T::EthSpec>,
    ) -> Result<Option<Hash256>, Error> {
        let iter = BlockRootsIterator::new(self.store.clone(), state);
        let iter_with_head = std::iter::once(Ok((beacon_block_root, state.slot)))
            .chain(iter)
            .map(|result| result.map_err(|e| e.into()));

        process_results(iter_with_head, |mut iter| {
            iter.find(|(_, slot)| *slot == target_slot)
                .map(|(root, _)| root)
        })
    }
/// Returns the block canonical root of the current canonical chain at a given slot, starting from the given state.
///
/// Returns `None` if the given slot doesn't exist in the chain.
Returns the block canonical root of the current canonical chain at a given slot, starting from the given state.
Returns `None` if the given slot doesn't exist in the chain.
Returns the block canonical root of the current canonical chain at a given slot starting from the given state . Returns ` None ` if the given slot doesn ' t exist in the chain .
pub fn root_at_slot_from_state(
        &self,
        target_slot: Slot,
        beacon_block_root: Hash256,
        state: &BeaconState<T::EthSpec>,
    ) -> Result<Option<Hash256>, Error> {
        let iter = BlockRootsIterator::new(self.store.clone(), state);
        let iter_with_head = std::iter::once(Ok((beacon_block_root, state.slot)))
            .chain(iter)
            .map(|result| result.map_err(|e| e.into()));
        process_results(iter_with_head, |mut iter| {
            iter.find(|(_, slot)| *slot == target_slot)
                .map(|(root, _)| root)
        })
    }
pub fn root_at_slot_from_state ( & self , target_slot : Slot , beacon_block_root : Hash256 , state : & BeaconState < T :: EthSpec > , ) -> Result < Option < Hash256 > , Error > { let iter = BlockRootsIterator :: new ( self . store . clone ( ) , state ) ; let iter_with_head = std :: iter :: once ( Ok ( ( beacon_block_root , state . slot ) ) ) . chain ( iter ) . map ( | result | result . map_err ( | e | e . into ( ) ) ) ; process_results ( iter_with_head , | mut iter | { iter . find ( | ( _ , slot ) | * slot == target_slot ) . map ( | ( root , _ ) | root ) } ) }
Returns the block canonical root of the current canonical chain at a given slot, starting from the given state.
Returns the block canonical root of the current canonical chain at a given slot starting from the given state .
&self
target_slot
Slot
beacon_block_root
Hash256
state
&BeaconState<T::EthSpec>