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

Function get_balance

chain/src/blockchain.rs:338–346  ·  view source on GitHub ↗
(blockchain: Arc<Mutex<BlockChain>>, account: &Account)

Source from the content-addressed store, hash-verified

336 }
337
338 pub(crate) async fn get_balance(blockchain: Arc<Mutex<BlockChain>>, account: &Account) -> U256 {
339 blockchain
340 .lock()
341 .await
342 .accounts
343 .get_account(account)
344 .unwrap()
345 .balance
346 }
347
348 #[tokio::test]
349 async fn creates_a_blockchain() {

Callers 2

sends_a_transactionFunction · 0.85
send_a_raw_transactionFunction · 0.85

Calls 1

get_accountMethod · 0.80

Tested by

no test coverage detected