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

Method new

chain/src/blockchain.rs:34–41  ·  view source on GitHub ↗
(storage: Arc<Storage>)

Source from the content-addressed store, hash-verified

32
33impl BlockChain {
34 pub(crate) fn new(storage: Arc<Storage>) -> Result<Self> {
35 Ok(Self {
36 accounts: AccountStorage::new(storage),
37 blocks: vec![Block::genesis()?],
38 transactions: Arc::new(Mutex::new(TransactionStorage::new())),
39 world_state: WorldState::new(),
40 })
41 }
42
43 pub(crate) fn get_current_block(&self) -> Result<Block> {
44 let block = self

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected