MCPcopy Create free account
hub / github.com/ddimaria/rust-blockchain-tutorial / get

Method get

chain/src/storage.rs:20–27  ·  view source on GitHub ↗
(&self, key: &[u8])

Source from the content-addressed store, hash-verified

18 type Error = ChainError;
19
20 fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>> {
21 let value = self
22 .db
23 .get(key)
24 .map_err(|_| ChainError::StorageNotFound(Storage::key_string(key)))?;
25
26 Ok(value)
27 }
28
29 fn insert(&self, key: &[u8], value: Vec<u8>) -> Result<()> {
30 self.db

Callers 4

get_accountMethod · 0.80
get_block_by_numberMethod · 0.80

Calls

no outgoing calls

Tested by 1