Expand description
Iterators for traversing MMRs of a given size, and functions for computing various MMR properties from their output.
Structs§
- Path
Iterator - A PathIterator returns a (parent_pos, sibling_pos) tuple for the sibling of each node along the path from a given perfect binary tree peak to a designated leaf, not including the peak itself.
- Peak
Iterator - A PeakIterator returns a (position, height) tuple for each peak in an MMR with the given size, in decreasing order of height.
Functions§
- leaf_
num_ to_ pos - Returns the position of the leaf with number
leaf_num
in an MMR. - leaf_
pos_ to_ num - Returns the number of the leaf at position
leaf_pos
in an MMR, or None if this is not a leaf. - nodes_
needing_ parents - Returns the set of peaks that will require a new parent after adding the next leaf to an MMR with the given peaks. This set is non-empty only if there is a height-0 (leaf) peak in the MMR. The result will contain this leaf peak plus the other MMR peaks with contiguously increasing height. Nodes in the result are ordered by decreasing height.
- pos_
to_ height - Returns the height of the node at position
pos
in an MMR.