ckb_merkle_mountain_range

Module helper

Source

Functionsยง

get_peak_map
Returns the height of the peaks in the mmr, presented by a bitmap. for example, for a mmr with 11 leaves, the mmr_size is 19, it will return 0b1011. 0b1011 indicates that the left peaks are at height 0, 1 and 3. 14 /
6 13 / \ /
2 5 9 12 17 / \ / \ / \ / \ /
0 1 3 4 7 8 10 11 15 16 18
get_peaks
Returns the pos of the peaks in the mmr. for example, for a mmr with 11 leaves, the mmr_size is 19, it will return [14, 17, 18]. 14 /
6 13 / \ /
2 5 9 12 17 / \ / \ / \ / \ /
0 1 3 4 7 8 10 11 15 16 18
leaf_index_to_mmr_size
leaf_index_to_pos
parent_offset
pos_height_in_tree
sibling_offset