Trait grin_pool::types::BlockChain

source ·
pub trait BlockChain: Sync + Send {
    // Required methods
    fn verify_coinbase_maturity(&self, inputs: &Inputs) -> Result<(), PoolError>;
    fn verify_tx_lock_height(&self, tx: &Transaction) -> Result<(), PoolError>;
    fn validate_tx(&self, tx: &Transaction) -> Result<(), PoolError>;
    fn validate_inputs(
        &self,
        inputs: &Inputs
    ) -> Result<Vec<OutputIdentifier>, PoolError>;
    fn chain_head(&self) -> Result<BlockHeader, PoolError>;
    fn get_block_header(&self, hash: &Hash) -> Result<BlockHeader, PoolError>;
    fn get_block_sums(&self, hash: &Hash) -> Result<BlockSums, PoolError>;
}
Expand description

Interface that the pool requires from a blockchain implementation.

Required Methods§

source

fn verify_coinbase_maturity(&self, inputs: &Inputs) -> Result<(), PoolError>

Verify any coinbase outputs being spent have matured sufficiently.

source

fn verify_tx_lock_height(&self, tx: &Transaction) -> Result<(), PoolError>

Verify any coinbase outputs being spent have matured sufficiently.

source

fn validate_tx(&self, tx: &Transaction) -> Result<(), PoolError>

Validate a transaction against the current utxo.

source

fn validate_inputs( &self, inputs: &Inputs ) -> Result<Vec<OutputIdentifier>, PoolError>

Validate inputs against the current utxo. Returns the vec of output identifiers that would be spent by these inputs if they can all be successfully spent.

source

fn chain_head(&self) -> Result<BlockHeader, PoolError>

source

fn get_block_header(&self, hash: &Hash) -> Result<BlockHeader, PoolError>

source

fn get_block_sums(&self, hash: &Hash) -> Result<BlockSums, PoolError>

Implementors§