/// Like `BlockStore::get_nth_ancestor`, but calls the closure 'callback' with
/// each intermediate block encountered while travelling from
/// 'block_hash' to its n'th ancestor.
///
/// The travelling algorithm uses back links to skip over parts of the chain,
/// so the callback will not be invoked for all blocks in the linear sequence.


The travelling algorithm uses back links to skip over parts of the chain,
so the callback will not be invoked for all blocks in the linear sequence.
The travelling algorithm uses back links to skip over parts of the chain so the callback will not be invoked for all blocks in the linear sequence .
pub fn for_path_to_nth_ancestor<B, F>(
    store: &mut BlockStoreConnection<B>,
    block_hash: &B::Id,
    distance: u64,
    callback: F,
) -> Result<BlockInfo<B::Id>, Error>
where
    B: Block,
    F: FnMut(&BlockInfo<B::Id>),
{
    let index = store.index.read().unwrap();
    let tx = store
        .inner
        .transaction()
        .map_err(|err| Error::BackendError(Box::new(err)))?;
    for_path_to_nth_ancestor_internal::<B, F>(&tx, &index, block_hash, distance, callback)
}
pub fn for_path_to_nth_ancestor < B , F > ( store : & mut BlockStoreConnection < B > , block_hash : & B :: Id , distance : u64 , callback : F , ) -> Result < BlockInfo < B :: Id > , Error > where B : Block , F : FnMut ( & BlockInfo < B :: Id > ) , { let index = store . index . read ( ) . unwrap ( ) ; let tx = store . inner . transaction ( ) . map_err ( | err | Error :: BackendError ( Box :: new ( err ) ) ) ? ; for_path_to_nth_ancestor_internal :: < B , F > ( & tx , & index , block_hash , distance , callback ) }
Like `BlockStore::get_nth_ancestor`, but calls the closure 'callback' with
each intermediate block encountered while travelling from
'block_hash' to its n'th ancestor.
Like ` BlockStore :: get_nth_ancestor ` but calls the closure ' callback ' with each intermediate block encountered while travelling from ' block_hash ' to its n ' th ancestor .
store
&mut BlockStoreConnection<B>
block_hash
&B::Id
distance
u64
callback
F