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
fn chunk_tail(&self) -> Result<BlockHeight, Error>
fn chunk_tail(&self) -> Result<BlockHeight, Error>
The chain Chunks Tail height.
fn header_head(&self) -> Result<Tip, Error>
fn header_head(&self) -> Result<Tip, Error>
Head of the header chain (not the same thing as head_header).
fn head_header(&mut self) -> Result<&BlockHeader, Error>
fn head_header(&mut self) -> Result<&BlockHeader, Error>
Header of the block at the head of the block chain (not the same thing as header_head).
fn final_head(&self) -> Result<Tip, Error>
fn final_head(&self) -> Result<Tip, Error>
The chain final head. It is guaranteed to be monotonically increasing.
fn largest_target_height(&self) -> Result<BlockHeight, Error>
fn largest_target_height(&self) -> Result<BlockHeight, Error>
Larget approval target height sent by us
fn get_partial_chunk(
&mut self,
chunk_hash: &ChunkHash
) -> Result<&PartialEncodedChunk, Error>
fn get_partial_chunk(
&mut self,
chunk_hash: &ChunkHash
) -> Result<&PartialEncodedChunk, Error>
Get partial chunk.
fn block_exists(&self, h: &CryptoHash) -> Result<bool, Error>
fn block_exists(&self, h: &CryptoHash) -> Result<bool, Error>
Does this full block exist?
fn get_previous_header(
&mut self,
header: &BlockHeader
) -> Result<&BlockHeader, Error>
fn get_previous_header(
&mut self,
header: &BlockHeader
) -> Result<&BlockHeader, Error>
Get previous header.
fn get_block_extra(
&mut self,
block_hash: &CryptoHash
) -> Result<&BlockExtra, Error>
fn get_block_extra(
&mut self,
block_hash: &CryptoHash
) -> Result<&BlockExtra, Error>
GEt block extra for given block.
fn get_chunk_extra(
&mut self,
block_hash: &CryptoHash,
shard_uid: &ShardUId
) -> Result<&ChunkExtra, Error>
fn get_chunk_extra(
&mut self,
block_hash: &CryptoHash,
shard_uid: &ShardUId
) -> Result<&ChunkExtra, Error>
Get chunk extra info for given block hash + shard id.
fn get_block_header(&mut self, h: &CryptoHash) -> Result<&BlockHeader, Error>
fn get_block_header(&mut self, h: &CryptoHash) -> Result<&BlockHeader, Error>
Get block header.
fn get_block_hash_by_height(
&mut self,
height: BlockHeight
) -> Result<CryptoHash, Error>
fn get_block_hash_by_height(
&mut self,
height: BlockHeight
) -> Result<CryptoHash, Error>
Returns hash of the block on the main chain for given height.
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_block_refcount(&mut self, block_hash: &CryptoHash) -> Result<&u64, Error>
Returns a number of references for Block with block_hash
fn get_any_chunk_hash_by_height_shard(
&mut self,
height: BlockHeight,
shard_id: ShardId
) -> Result<&ChunkHash, Error>
fn get_any_chunk_hash_by_height_shard(
&mut self,
height: BlockHeight,
shard_id: ShardId
) -> Result<&ChunkHash, Error>
Check if we saw chunk hash at given height and shard id.
Returns resulting receipt for given block.
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 is_block_challenged(&mut self, hash: &CryptoHash) -> Result<bool, Error>
Returns whether the block with the given hash was challenged
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 is_invalid_chunk(
&mut self,
chunk_hash: &ChunkHash
) -> Result<Option<&EncodedShardChunk>, Error>
Returns encoded chunk if it’s invalid otherwise None.
fn get_shard_id_for_receipt_id(
&mut self,
receipt_id: &CryptoHash
) -> Result<&ShardId, Error>
fn get_shard_id_for_receipt_id(
&mut self,
receipt_id: &CryptoHash
) -> Result<&ShardId, Error>
Get destination shard id for receipt id.
fn get_next_block_hash_with_new_chunk(
&mut self,
block_hash: &CryptoHash,
shard_id: ShardId
) -> Result<Option<&CryptoHash>, Error>
fn get_next_block_hash_with_new_chunk(
&mut self,
block_hash: &CryptoHash,
shard_id: ShardId
) -> Result<Option<&CryptoHash>, Error>
For a given block and a given shard, get the next block hash where a new chunk for the shard is included.
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_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>
Provided methods
fn get_chunk_clone_from_header(
&mut self,
header: &ShardChunkHeader
) -> Result<ShardChunk, Error>
fn get_chunk_clone_from_header(
&mut self,
header: &ShardChunkHeader
) -> Result<ShardChunk, Error>
Get full chunk from header, with possible error that contains the header for further retrieval.
fn get_earliest_block_hash(&mut self) -> Result<Option<CryptoHash>, Error>
fn get_earliest_block_hash(&mut self) -> Result<Option<CryptoHash>, Error>
Returns hash of the first available block after genesis.
fn get_header_by_height(
&mut self,
height: BlockHeight
) -> Result<&BlockHeader, Error>
fn get_header_by_height(
&mut self,
height: BlockHeight
) -> Result<&BlockHeader, Error>
Returns block header from the current chain for given height if present.
fn get_header_on_chain_by_height(
&mut self,
sync_hash: &CryptoHash,
height: BlockHeight
) -> Result<&BlockHeader, Error>
fn get_header_on_chain_by_height(
&mut self,
sync_hash: &CryptoHash,
height: BlockHeight
) -> Result<&BlockHeader, Error>
Returns block header from the current chain defined by sync_hash for given height if present.
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>
fn get_epoch_id_of_last_block_with_chunk(
&mut self,
runtime_adapter: &dyn RuntimeAdapter,
hash: &CryptoHash,
shard_id: ShardId
) -> Result<EpochId, Error>
Get epoch id of the last block with existing chunk for the given shard id.