Trait near_chain::ChainStoreAccess[][src]

pub trait ChainStoreAccess {
Show 43 methods fn store(&self) -> &Store;
fn head(&self) -> Result<Tip, Error>;
fn tail(&self) -> Result<BlockHeight, Error>;
fn chunk_tail(&self) -> Result<BlockHeight, Error>;
fn fork_tail(&self) -> Result<BlockHeight, Error>;
fn header_head(&self) -> Result<Tip, Error>;
fn head_header(&mut self) -> Result<&BlockHeader, Error>;
fn final_head(&self) -> Result<Tip, Error>;
fn largest_target_height(&self) -> Result<BlockHeight, Error>;
fn get_block(&mut self, h: &CryptoHash) -> Result<&Block, Error>;
fn get_chunk(
        &mut self,
        chunk_hash: &ChunkHash
    ) -> Result<&ShardChunk, Error>;
fn get_partial_chunk(
        &mut self,
        chunk_hash: &ChunkHash
    ) -> Result<&PartialEncodedChunk, Error>;
fn block_exists(&self, h: &CryptoHash) -> Result<bool, Error>;
fn get_previous_header(
        &mut self,
        header: &BlockHeader
    ) -> Result<&BlockHeader, Error>;
fn get_block_extra(
        &mut self,
        block_hash: &CryptoHash
    ) -> Result<&BlockExtra, Error>;
fn get_chunk_extra(
        &mut self,
        block_hash: &CryptoHash,
        shard_uid: &ShardUId
    ) -> Result<&ChunkExtra, Error>;
fn get_block_header(
        &mut self,
        h: &CryptoHash
    ) -> Result<&BlockHeader, Error>;
fn get_block_hash_by_height(
        &mut self,
        height: BlockHeight
    ) -> Result<CryptoHash, Error>;
fn get_next_block_hash(
        &mut self,
        hash: &CryptoHash
    ) -> Result<&CryptoHash, Error>;
fn get_epoch_light_client_block(
        &mut self,
        hash: &CryptoHash
    ) -> Result<&LightClientBlockView, Error>;
fn get_block_refcount(
        &mut self,
        block_hash: &CryptoHash
    ) -> Result<&u64, Error>;
fn get_any_chunk_hash_by_height_shard(
        &mut self,
        height: BlockHeight,
        shard_id: ShardId
    ) -> Result<&ChunkHash, Error>;
fn get_outgoing_receipts(
        &mut self,
        hash: &CryptoHash,
        shard_id: ShardId
    ) -> Result<&Vec<Receipt>, Error>;
fn get_incoming_receipts(
        &mut self,
        hash: &CryptoHash,
        shard_id: ShardId
    ) -> Result<&Vec<ReceiptProof>, Error>;
fn is_block_challenged(&mut self, hash: &CryptoHash) -> Result<bool, Error>;
fn get_blocks_to_catchup(
        &self,
        prev_hash: &CryptoHash
    ) -> Result<Vec<CryptoHash>, Error>;
fn is_invalid_chunk(
        &mut self,
        chunk_hash: &ChunkHash
    ) -> Result<Option<&EncodedShardChunk>, Error>;
fn get_shard_id_for_receipt_id(
        &mut self,
        receipt_id: &CryptoHash
    ) -> Result<&ShardId, Error>;
fn get_next_block_hash_with_new_chunk(
        &mut self,
        block_hash: &CryptoHash,
        shard_id: ShardId
    ) -> Result<Option<&CryptoHash>, Error>;
fn get_last_block_with_new_chunk(
        &mut self,
        shard_id: ShardId
    ) -> Result<Option<&CryptoHash>, Error>;
fn get_transaction(
        &mut self,
        tx_hash: &CryptoHash
    ) -> Result<Option<&SignedTransaction>, Error>;
fn get_receipt(
        &mut self,
        receipt_id: &CryptoHash
    ) -> Result<Option<&Receipt>, Error>;
fn get_genesis_height(&self) -> BlockHeight;
fn get_block_merkle_tree(
        &mut self,
        block_hash: &CryptoHash
    ) -> Result<&PartialMerkleTree, Error>;
fn get_block_hash_from_ordinal(
        &mut self,
        block_ordinal: NumBlocks
    ) -> Result<&CryptoHash, Error>;
fn is_height_processed(
        &mut self,
        height: BlockHeight
    ) -> Result<bool, Error>; fn get_chunk_clone_from_header(
        &mut self,
        header: &ShardChunkHeader
    ) -> Result<ShardChunk, Error> { ... }
fn get_earliest_block_hash(&mut self) -> Result<Option<CryptoHash>, Error> { ... }
fn get_header_by_height(
        &mut self,
        height: BlockHeight
    ) -> Result<&BlockHeader, Error> { ... }
fn get_header_on_chain_by_height(
        &mut self,
        sync_hash: &CryptoHash,
        height: BlockHeight
    ) -> Result<&BlockHeader, Error> { ... }
fn get_block_merkle_tree_from_ordinal(
        &mut self,
        block_ordinal: NumBlocks
    ) -> Result<&PartialMerkleTree, Error> { ... }
fn get_block_height(
        &mut self,
        hash: &CryptoHash
    ) -> Result<BlockHeight, Error> { ... }
fn get_epoch_id_of_last_block_with_chunk(
        &mut self,
        runtime_adapter: &dyn RuntimeAdapter,
        hash: &CryptoHash,
        shard_id: ShardId
    ) -> Result<EpochId, Error> { ... }
}
Expand description

Accesses the chain store. Used to create atomic editable views that can be reverted.

Required methods

Returns underlaying store.

The chain head.

The chain Blocks Tail height.

The chain Chunks Tail height.

Tail height of the fork cleaning process.

Head of the header chain (not the same thing as head_header).

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

The chain final head. It is guaranteed to be monotonically increasing.

Larget approval target height sent by us

Get full block.

Get full chunk.

Get partial chunk.

Does this full block exist?

Get previous header.

GEt block extra for given block.

Get chunk extra info for given block hash + shard id.

Get block header.

Returns hash of the block on the main chain for given height.

Returns a number of references for Block with block_hash

Check if we saw chunk hash at given height and shard id.

Returns resulting receipt for given block.

Returns whether the block with the given hash was challenged

Returns encoded chunk if it’s invalid otherwise None.

Get destination shard id for receipt id.

For a given block and a given shard, get the next block hash where a new chunk for the shard is included.

Provided methods

Get full chunk from header, with possible error that contains the header for further retrieval.

Returns hash of the first available block after genesis.

Returns block header from the current chain for given height if present.

Returns block header from the current chain defined by sync_hash for given height if present.

Get epoch id of the last block with existing chunk for the given shard id.

Implementors