2021-06-17 18:24:18 -07:00
|
|
|
use crate::{Hashable, Recording, Tree};
|
2021-06-17 18:17:47 -07:00
|
|
|
|
|
|
|
#[derive(Clone)]
|
2021-06-17 18:24:18 -07:00
|
|
|
pub struct EfficientTree<H: Hashable> {
|
|
|
|
something: H
|
2021-06-17 18:17:47 -07:00
|
|
|
}
|
|
|
|
|
2021-06-17 18:24:18 -07:00
|
|
|
impl<H: Hashable> EfficientTree<H> {
|
2021-06-17 18:17:47 -07:00
|
|
|
pub fn new(depth: usize) -> Self {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:24:18 -07:00
|
|
|
impl<H: Hashable> Tree<H> for EfficientTree<H> {
|
2021-06-17 18:17:47 -07:00
|
|
|
type Recording = EfficientRecording<H>;
|
|
|
|
|
2021-06-17 18:24:18 -07:00
|
|
|
fn append(&mut self, value: &H) -> bool {
|
2021-06-17 18:17:47 -07:00
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Obtains the current root of this Merkle tree.
|
2021-06-17 18:24:18 -07:00
|
|
|
fn root(&self) -> H {
|
2021-06-17 18:17:47 -07:00
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 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.
|
|
|
|
fn witness(&mut self) -> bool {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Obtains an authentication path to the value specified in the tree.
|
|
|
|
/// Returns `None` if there is no available authentication path to the
|
|
|
|
/// specified value.
|
2021-06-17 18:24:18 -07:00
|
|
|
fn authentication_path(&self, value: &H) -> Option<(usize, Vec<H>)> {
|
2021-06-17 18:17:47 -07:00
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 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.
|
2021-06-17 18:24:18 -07:00
|
|
|
fn remove_witness(&mut self, value: &H) -> bool {
|
2021-06-17 18:17:47 -07:00
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Marks the current tree state as a checkpoint if it is not already a
|
|
|
|
/// checkpoint.
|
|
|
|
fn checkpoint(&mut self) {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Rewinds the tree state to the previous checkpoint. 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.
|
|
|
|
fn rewind(&mut self) -> bool {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Start a recording of append operations performed on a tree.
|
|
|
|
fn recording(&self) -> EfficientRecording<H> {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Plays a recording of append operations back. Returns true if successful
|
|
|
|
/// and false if the recording is incompatible with the current tree state.
|
|
|
|
fn play(&mut self, recording: &EfficientRecording<H>) -> bool {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
2021-06-17 18:24:18 -07:00
|
|
|
pub struct EfficientRecording<H: Hashable> {
|
|
|
|
something: H
|
2021-06-17 18:17:47 -07:00
|
|
|
}
|
|
|
|
|
2021-06-17 18:24:18 -07:00
|
|
|
impl<H: Hashable> Recording<H> for EfficientRecording<H> {
|
|
|
|
fn append(&mut self, value: &H) -> bool {
|
2021-06-17 18:17:47 -07:00
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn play(&mut self, recording: &Self) -> bool {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|