CommitmentTree (Anoma v0.34.0)
A simple commitment tree.
Currently stores all commitments forever, and stores the full tree in memory, pending future more sophisticated retention policies. Does not yet store any anchors itself for the same reason--this is a complex policy level decision.
Has a fixed depth.
Fiats that empty subtrees have a hash of 0 for simplicity.
Summary
Functions
Adds commitments to the commitment tree, and returns the new tree and the anchor. TODO handle the tree's filling up
Creates a new CommitmentTree
struct.
Types
@type t() :: %CommitmentTree{ map: %{required(binary()) => non_neg_integer()}, root: CommitmentTree.Node.t(), size: integer(), spec: CommitmentTree.Spec.t() }
Functions
Adds commitments to the commitment tree, and returns the new tree and the anchor. TODO handle the tree's filling up
@spec new(CommitmentTree.Spec.t()) :: t()
Creates a new CommitmentTree
struct.
@spec prove(t(), integer() | binary()) :: CommitmentTree.Proof.t()