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

Method add_block

code/chapter09/blockchain/blockchain2/core/src/blockchain.rs:25–30  ·  view source on GitHub ↗
(&mut self, txs: String)

Source from the content-addressed store, hash-verified

23 }
24
25 pub fn add_block(&mut self, txs: String) {
26 let pre_block = &self.blocks[self.blocks.len() - 1];
27 let pre_hash = pre_block.hash.clone();
28 let new_block = Block::new(txs, pre_hash, self.curr_bits);
29 self.blocks.push(new_block);
30 }
31
32 pub fn block_info(&self) {
33 for b in self.blocks.iter() {

Callers 1

mainFunction · 0.45

Calls 2

lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected