Trait WalletCommitmentTrees

Source
pub trait WalletCommitmentTrees {
    type Error: Debug;
    type SaplingShardStore<'a>: ShardStore<H = Node, CheckpointId = BlockHeight, Error = Self::Error>;
    type OrchardShardStore<'a>: ShardStore<H = MerkleHashOrchard, CheckpointId = BlockHeight, Error = Self::Error>;

    // Required methods
    fn with_sapling_tree_mut<F, A, E>(&mut self, callback: F) -> Result<A, E>
       where for<'a> F: FnMut(&'a mut ShardTree<Self::SaplingShardStore<'a>, { sapling::NOTE_COMMITMENT_TREE_DEPTH }, SAPLING_SHARD_HEIGHT>) -> Result<A, E>,
             E: From<ShardTreeError<Self::Error>>;
    fn put_sapling_subtree_roots(
        &mut self,
        start_index: u64,
        roots: &[CommitmentTreeRoot<Node>],
    ) -> Result<(), ShardTreeError<Self::Error>>;
    fn with_orchard_tree_mut<F, A, E>(&mut self, callback: F) -> Result<A, E>
       where for<'a> F: FnMut(&'a mut ShardTree<Self::OrchardShardStore<'a>, { _ }, ORCHARD_SHARD_HEIGHT>) -> Result<A, E>,
             E: From<ShardTreeError<Self::Error>>;
    fn put_orchard_subtree_roots(
        &mut self,
        start_index: u64,
        roots: &[CommitmentTreeRoot<MerkleHashOrchard>],
    ) -> Result<(), ShardTreeError<Self::Error>>;
}
Expand description

This trait describes a capability for manipulating wallet note commitment trees.

Required Associated Types§

Source

type Error: Debug

Source

type SaplingShardStore<'a>: ShardStore<H = Node, CheckpointId = BlockHeight, Error = Self::Error>

The type of the backing [ShardStore] for the Sapling note commitment tree.

Source

type OrchardShardStore<'a>: ShardStore<H = MerkleHashOrchard, CheckpointId = BlockHeight, Error = Self::Error>

Available on crate feature orchard only.

The type of the backing [ShardStore] for the Orchard note commitment tree.

Required Methods§

Source

fn with_sapling_tree_mut<F, A, E>(&mut self, callback: F) -> Result<A, E>
where for<'a> F: FnMut(&'a mut ShardTree<Self::SaplingShardStore<'a>, { sapling::NOTE_COMMITMENT_TREE_DEPTH }, SAPLING_SHARD_HEIGHT>) -> Result<A, E>, E: From<ShardTreeError<Self::Error>>,

Evaluates the given callback function with a reference to the Sapling note commitment tree maintained by the wallet.

Source

fn put_sapling_subtree_roots( &mut self, start_index: u64, roots: &[CommitmentTreeRoot<Node>], ) -> Result<(), ShardTreeError<Self::Error>>

Adds a sequence of Sapling note commitment tree subtree roots to the data store.

Each such value should be the Merkle root of a subtree of the Sapling note commitment tree containing 2^SAPLING_SHARD_HEIGHT note commitments.

Source

fn with_orchard_tree_mut<F, A, E>(&mut self, callback: F) -> Result<A, E>
where for<'a> F: FnMut(&'a mut ShardTree<Self::OrchardShardStore<'a>, { _ }, ORCHARD_SHARD_HEIGHT>) -> Result<A, E>, E: From<ShardTreeError<Self::Error>>,

Available on crate feature orchard only.

Evaluates the given callback function with a reference to the Orchard note commitment tree maintained by the wallet.

Source

fn put_orchard_subtree_roots( &mut self, start_index: u64, roots: &[CommitmentTreeRoot<MerkleHashOrchard>], ) -> Result<(), ShardTreeError<Self::Error>>

Available on crate feature orchard only.

Adds a sequence of Orchard note commitment tree subtree roots to the data store.

Each such value should be the Merkle root of a subtree of the Orchard note commitment tree containing 2^ORCHARD_SHARD_HEIGHT note commitments.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl WalletCommitmentTrees for MockWalletDb

Available on crate feature test-dependencies only.
Source§

type Error = Infallible

Source§

type SaplingShardStore<'a> = MemoryShardStore<Node, BlockHeight>

Source§

type OrchardShardStore<'a> = MemoryShardStore<MerkleHashOrchard, BlockHeight>