Trait incrementalmerkletree::Tree[][src]

pub trait Tree<H>: Frontier<H> {
    type Recording: Recording<H>;
    fn witness(&mut self) -> bool;
fn authentication_path(&self, value: &H) -> Option<(Position, Vec<H>)>;
fn remove_witness(&mut self, value: &H) -> bool;
fn checkpoint(&mut self);
fn rewind(&mut self) -> bool;
fn recording(&self) -> Self::Recording;
fn play(&mut self, recording: &Self::Recording) -> bool; }
Expand description

A Merkle tree that supports incremental appends, witnessing of leaf nodes, checkpoints and rollbacks.

Associated Types

The type of recordings that can be made of the operations of this tree.

Required methods

Marks the current tree state leaf as a value that we’re interested in witnessing. Returns true if successful and false if the tree is empty.

Obtains an authentication path to the value specified in the tree. Returns None if there is no available authentication path to the specified value.

Marks the specified tree state value as a value we’re no longer interested in maintaining a witness for. Returns true if successful and false if the value is not a known witness.

Creates a new checkpoint for the current tree state. It is valid to have multiple checkpoints for the same tree state, and each rewind call will remove a single checkpoint.

Rewinds the tree state to the previous checkpoint, and then removes that checkpoint record. If there are multiple checkpoints at a given tree state, the tree state will not be altered until all checkpoints at that tree state have been removed using rewind. This function will fail and return false if there is no previous checkpoint or in the event witness data would be destroyed in the process.

In the case that this method returns false, the user should have explicitly called remove_witness for each witnessed leaf marked since the last checkpoint.

Start a recording of append operations performed on a tree.

Plays a recording of append operations back. Returns true if successful and false if the recording is incompatible with the current tree state.

Implementors