Skip to main content

BlockStore

Trait BlockStore 

Source
pub trait BlockStore {
    // Required methods
    fn get_block(&self, height: u64) -> Result<Option<Block>>;
    fn get_block_by_hash(&self, hash: &BlockHash) -> Result<Option<Block>>;
    fn get_header(&self, height: u64) -> Result<Option<BlockHeader>>;
    fn put_block(&self, block: &Block) -> Result<()>;
    fn latest_height(&self) -> Result<Option<u64>>;
    fn latest_block(&self) -> Result<Option<Block>>;
}
Expand description

Store for blocks.

Required Methods§

Source

fn get_block(&self, height: u64) -> Result<Option<Block>>

Get a block by height.

Source

fn get_block_by_hash(&self, hash: &BlockHash) -> Result<Option<Block>>

Get a block by hash.

Source

fn get_header(&self, height: u64) -> Result<Option<BlockHeader>>

Get a block header by height.

Source

fn put_block(&self, block: &Block) -> Result<()>

Store a block.

Source

fn latest_height(&self) -> Result<Option<u64>>

Get the latest block height.

Source

fn latest_block(&self) -> Result<Option<Block>>

Get the latest block.

Implementors§