pub struct OneshotMerkleTree { /* private fields */ }
Expand description
A Merkle tree that is created once but never modified.
This is useful for per-block data such as transaction lists.
Implementations§
Source§impl OneshotMerkleTree
impl OneshotMerkleTree
pub const EMPTY_HASH: Hash256
Sourcepub fn create_merkle_proof(&self, key: Hash256) -> Option<MerkleProof>
pub fn create_merkle_proof(&self, key: Hash256) -> Option<MerkleProof>
Creates a Merkle proof for a given data in the tree.
Returns None
if the data is not in the tree.
Given a tree [[1, 2, 3], [4, 5], [6]], Merkle proof for 2 is [1, 5] and Merkle proof for 3 is [OnlyChild, 4].
For LeftChild
and RightChild
, pair hash of the sibling node is given.
For OnlyChild
, only the instruction is given.
Auto Trait Implementations§
impl Freeze for OneshotMerkleTree
impl RefUnwindSafe for OneshotMerkleTree
impl Send for OneshotMerkleTree
impl Sync for OneshotMerkleTree
impl Unpin for OneshotMerkleTree
impl UnwindSafe for OneshotMerkleTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more