Struct grin_chain::store::ChainStore

source ·
pub struct ChainStore { /* private fields */ }
Expand description

All chain-related database operations

Implementations§

source§

impl ChainStore

source

pub fn new(db_root: &str) -> Result<ChainStore, Error>

Create new chain store

source

pub fn head(&self) -> Result<Tip, Error>

The current chain head.

source

pub fn header_head(&self) -> Result<Tip, Error>

The current header head (may differ from chain head).

source

pub fn tail(&self) -> Result<Tip, Error>

The current chain “tail” (earliest block in the store).

source

pub fn pibd_head(&self) -> Result<Tip, Error>

The current PIBD head (will differ from the other heads. Return genesis block if PIBD head doesn’t exist).

source

pub fn head_header(&self) -> Result<BlockHeader, Error>

Header of the block at the head of the block chain (not the same thing as header_head).

source

pub fn get_block(&self, h: &Hash) -> Result<Block, Error>

Get full block.

source

pub fn block_exists(&self, h: &Hash) -> Result<bool, Error>

Does this full block exist?

source

pub fn get_block_sums(&self, h: &Hash) -> Result<BlockSums, Error>

Get block_sums for the block hash.

source

pub fn get_previous_header( &self, header: &BlockHeader ) -> Result<BlockHeader, Error>

Get previous header.

source

pub fn get_previous_header_skip_proof( &self, header: &BlockHeader ) -> Result<BlockHeader, Error>

Get previous header without deserializing the proof nonces

source

pub fn get_block_header(&self, h: &Hash) -> Result<BlockHeader, Error>

Get block header.

source

pub fn get_block_header_skip_proof( &self, h: &Hash ) -> Result<BlockHeader, Error>

Get block header without deserializing the full PoW Proof; currently used for difficulty iterator which is called many times but doesn’t need the proof

source

pub fn get_output_pos(&self, commit: &Commitment) -> Result<u64, Error>

Get PMMR pos for the given output commitment.

source

pub fn get_output_pos_height( &self, commit: &Commitment ) -> Result<Option<CommitPos>, Error>

Get PMMR pos and block height for the given output commitment.

source

pub fn batch(&self) -> Result<Batch<'_>, Error>

Builds a new batch to be used with this store.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> SafeBorrow<T> for T
where T: ?Sized,

source§

fn borrow_replacement(ptr: &T) -> &T

Given ptr, which was obtained from a prior call to Self::borrow(), return a value with the same nominal lifetime which is guaranteed to survive mutations to Self. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnsafeAny for T
where T: Any,