View Source MSSMT.LeafNode (MSSMT v0.1.1)
Represents a leaf node in the Merkle Sum Sparse Merkle Tree (MSSMT).
Summary
Types
@type t() :: %MSSMT.LeafNode{key: <<_::256>>, sum: non_neg_integer(), value: binary()}
Functions
@spec compute_hash(t()) :: MSSMT.NodeHash.t()
Computes the hash of the leaf node.
The hash is computed over the concatenation of the value and the sum (as unsigned little-endian 64-bit integer).
Examples
iex> MSSMT.LeafNode.compute_hash(leaf_node)
<<...>>
@spec new(<<_::256>>, binary(), non_neg_integer()) :: t()
Creates a new leaf node.
Parameters
key: The key associated with the leaf (256-bit binary).value: The value stored in the leaf.sum: The sum associated with the leaf.
Examples
iex> MSSMT.LeafNode.new(key, "value", 100)
%MSSMT.LeafNode{...}