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

Method upsert

chain/src/account.rs:28–32  ·  view source on GitHub ↗
(&mut self, key: &Account, data: &AccountData)

Source from the content-addressed store, hash-verified

26 }
27
28 pub(crate) fn upsert(&mut self, key: &Account, data: &AccountData) -> Result<()> {
29 self.trie
30 .insert(key.as_ref(), &serialize(&data)?)
31 .map_err(|_| ChainError::StoragePutError(Storage::key_string(key)))
32 }
33
34 /// Add an account with default account data.
35 /// Skip if the account already exists.

Callers 4

add_accountMethod · 0.80
add_account_balanceMethod · 0.80
update_nonceMethod · 0.80

Calls 2

serializeFunction · 0.85
insertMethod · 0.80

Tested by

no test coverage detected