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

Method add_empty_account

chain/src/account.rs:36–43  ·  view source on GitHub ↗

Add an account with default account data. Skip if the account already exists.

(&mut self, key: &Account)

Source from the content-addressed store, hash-verified

34 /// Add an account with default account data.
35 /// Skip if the account already exists.
36 pub(crate) fn add_empty_account(&mut self, key: &Account) -> Result<bool> {
37 let should_add = self.get_account(key).is_err();
38 if should_add {
39 self.add_account(key, &AccountData::new(None))?;
40 }
41
42 Ok(should_add)
43 }
44
45 pub fn add_contract_account(&mut self, key: &Account, data: Bytes) -> Result<Account> {
46 let nonce = self.get_account(key)?.nonce;

Callers 1

process_transactionMethod · 0.80

Calls 2

get_accountMethod · 0.80
add_accountMethod · 0.80

Tested by

no test coverage detected