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

Method get_subroots

header-chain/src/mmr_native.rs:47–56  ·  view source on GitHub ↗

Returns the subroots of the MMR.

(&self)

Source from the content-addressed store, hash-verified

45
46 /// Returns the subroots of the MMR.
47 fn get_subroots(&self) -> Vec<[u8; 32]> {
48 let mut subroots: Vec<[u8; 32]> = vec![];
49 for level in &self.nodes {
50 if level.len() % 2 == 1 {
51 subroots.push(level[level.len() - 1]);
52 }
53 }
54 subroots.reverse();
55 subroots
56 }
57
58 /// Generates a proof for a given index. Returns the leaf as well.
59 pub fn generate_proof(&self, index: u32) -> ([u8; 32], MMRInclusionProof) {

Callers 2

verify_proofMethod · 0.80
test_mmr_crosscheckFunction · 0.80

Calls 2

lenMethod · 0.80
pushMethod · 0.45

Tested by 1

test_mmr_crosscheckFunction · 0.64