MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / update_hmap

Method update_hmap

code/chapter09/blockchain/blockchain8/core/src/blockchain.rs:71–75  ·  view source on GitHub ↗
(hmap: &mut Mutex<HashMap<String, Block>>, block: Block)

Source from the content-addressed store, hash-verified

69 }
70
71 fn update_hmap(hmap: &mut Mutex<HashMap<String, Block>>, block: Block) {
72 let mut hmap = hmap.lock().unwrap();
73 let hash = block.hash.clone();
74 hmap.insert(hash, block);
75 }
76
77 fn write_block(db: &mut Database<BKey>, block: &Block) {
78 let header_ser = serialize(&(block.header));

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected