Trait nakamoto_test::block::tree::BlockTree
source · pub trait BlockTree: BlockReader {
fn import_blocks<I, C>(
&mut self,
chain: I,
context: &C
) -> Result<ImportResult, Error>
where
I: Iterator<Item = BlockHeader>,
C: Clock;
fn extend_tip<C>(
&mut self,
header: BlockHeader,
context: &C
) -> Result<ImportResult, Error>
where
C: Clock;
}
Expand description
A representation of all known blocks that keeps track of the longest chain.
Required Methods
sourcefn import_blocks<I, C>(
&mut self,
chain: I,
context: &C
) -> Result<ImportResult, Error>where
I: Iterator<Item = BlockHeader>,
C: Clock,
fn import_blocks<I, C>(
&mut self,
chain: I,
context: &C
) -> Result<ImportResult, Error>where
I: Iterator<Item = BlockHeader>,
C: Clock,
Import a chain of block headers into the block tree.
sourcefn extend_tip<C>(
&mut self,
header: BlockHeader,
context: &C
) -> Result<ImportResult, Error>where
C: Clock,
fn extend_tip<C>(
&mut self,
header: BlockHeader,
context: &C
) -> Result<ImportResult, Error>where
C: Clock,
Attempts to extend the active chain. Returns Ok
with ImportResult::TipUnchanged
if
the block didn’t connect, and Err
if the block was invalid.