MCPcopy Create free account
hub / github.com/BitVM/BitVM / append

Method append

header-chain/src/mmr_guest.rs:23–33  ·  view source on GitHub ↗
(&mut self, leaf: [u8; 32])

Source from the content-addressed store, hash-verified

21 }
22
23 pub fn append(&mut self, leaf: [u8; 32]) {
24 let mut current = leaf;
25 let mut size = self.size;
26 while size % 2 == 1 {
27 let sibling = self.subroots.pop().unwrap();
28 current = hash_pair(sibling, current);
29 size /= 2
30 }
31 self.subroots.push(current);
32 self.size += 1;
33 }
34
35 /// Verifies an inclusion proof against the current MMR root
36 pub fn verify_proof(&self, leaf: [u8; 32], mmr_proof: &MMRInclusionProof) -> bool {

Callers 8

apply_blocksMethod · 0.45
get_objectMethod · 0.45
handle_historyMethod · 0.45
lock_script_cache_idFunction · 0.45
test_final_circuitFunction · 0.45
u32_witness_to_bytesFunction · 0.45
u32_witness_to_bytesFunction · 0.45
test_spvFunction · 0.45

Calls 2

hash_pairFunction · 0.70
pushMethod · 0.45

Tested by 2

test_final_circuitFunction · 0.36
test_spvFunction · 0.36