pub trait ChainStateAccess {
// Required methods
fn has_object(&self, hash: &Hash) -> bool;
fn get_object(&self, hash: &Hash) -> Option<ChainObject>;
fn get_headers_for_locator(
&self,
locator: &[Hash],
stop: &Hash,
) -> Vec<BlockHeader>;
fn get_mempool_transactions(&self) -> Vec<Transaction>;
}Expand description
Trait for chain state access (node layer implements this)
This trait allows the protocol layer to query chain state without owning it. The node layer provides real implementations using its storage modules (BlockStore, TxIndex, MempoolManager).
Required Methods§
Sourcefn has_object(&self, hash: &Hash) -> bool
fn has_object(&self, hash: &Hash) -> bool
Check if we have an object (block or transaction) by hash
Sourcefn get_object(&self, hash: &Hash) -> Option<ChainObject>
fn get_object(&self, hash: &Hash) -> Option<ChainObject>
Get an object (block or transaction) by hash
Sourcefn get_headers_for_locator(
&self,
locator: &[Hash],
stop: &Hash,
) -> Vec<BlockHeader>
fn get_headers_for_locator( &self, locator: &[Hash], stop: &Hash, ) -> Vec<BlockHeader>
Get headers for a block locator (for GetHeaders requests) This implements the Bitcoin block locator algorithm
Sourcefn get_mempool_transactions(&self) -> Vec<Transaction>
fn get_mempool_transactions(&self) -> Vec<Transaction>
Get all mempool transactions