pub struct MerkleTree { /* private fields */ }Expand description
Complete information about LNPBP-4 merkle tree.
Implementations§
Source§impl MerkleTree
impl MerkleTree
pub fn root(&self) -> MerkleHash
Source§impl MerkleTree
impl MerkleTree
Sourcepub fn protocol_id_pos(&self, protocol_id: ProtocolId) -> u32
pub fn protocol_id_pos(&self, protocol_id: ProtocolId) -> u32
Computes position for a given protocol_id within the tree leaves.
Sourcepub fn width_limit(&self) -> u32
pub fn width_limit(&self) -> u32
Computes the maximum possible width of the merkle tree, equal to 2 ^ depth.
Sourcepub fn factored_width(&self) -> u32
pub fn factored_width(&self) -> u32
Computes the factored width of the merkle tree, equal to 2 ^ depth - cofactor.
pub fn depth(&self) -> u5
pub fn cofactor(&self) -> u16
pub fn entropy(&self) -> u64
pub fn into_proofs(self) -> impl Iterator<Item = (ProtocolId, MerkleProof)>
Trait Implementations§
Source§impl Clone for MerkleTree
impl Clone for MerkleTree
Source§fn clone(&self) -> MerkleTree
fn clone(&self) -> MerkleTree
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl CommitEncode for MerkleTree
impl CommitEncode for MerkleTree
Source§type CommitmentId = Commitment
type CommitmentId = Commitment
Type of the resulting commitment.
Source§fn commit_encode(&self, engine: &mut CommitEngine)
fn commit_encode(&self, engine: &mut CommitEngine)
Encodes the data for the commitment by writing them directly into a
std::io::Write writer instanceSource§impl Conceal for MerkleTree
impl Conceal for MerkleTree
Source§impl Debug for MerkleTree
impl Debug for MerkleTree
Source§impl From<&MerkleTree> for MerkleBlock
impl From<&MerkleTree> for MerkleBlock
Source§fn from(tree: &MerkleTree) -> Self
fn from(tree: &MerkleTree) -> Self
Converts to this type from the input type.
Source§impl From<MerkleTree> for MerkleBlock
impl From<MerkleTree> for MerkleBlock
Source§fn from(tree: MerkleTree) -> Self
fn from(tree: MerkleTree) -> Self
Converts to this type from the input type.
Source§impl Hash for MerkleTree
impl Hash for MerkleTree
Source§impl PartialEq for MerkleTree
impl PartialEq for MerkleTree
Source§impl Proof for MerkleTree
impl Proof for MerkleTree
Source§impl StrictDecode for MerkleTree
impl StrictDecode for MerkleTree
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl StrictDumb for MerkleTree
impl StrictDumb for MerkleTree
fn strict_dumb() -> Self
Source§impl StrictEncode for MerkleTree
impl StrictEncode for MerkleTree
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl StrictStruct for MerkleTree
impl StrictStruct for MerkleTree
const ALL_FIELDS: &'static [&'static str]
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictType for MerkleTree
impl StrictType for MerkleTree
const STRICT_LIB_NAME: &'static str = LIB_NAME_COMMIT_VERIFY
fn strict_name() -> Option<TypeName>
Source§impl TryCommitVerify<MultiSource, UntaggedProtocol> for MerkleTree
§Panics
Panics if the crate is compiled without rand feature enabled and the
MultiSource doesn’t contain a static entropy.
impl TryCommitVerify<MultiSource, UntaggedProtocol> for MerkleTree
§Panics
Panics if the crate is compiled without rand feature enabled and the
MultiSource doesn’t contain a static entropy.
Source§type Error = Error
type Error = Error
Error type that may be reported during
TryCommitVerify::try_commit.Source§fn try_commit(source: &MultiSource) -> Result<Self, Error>
fn try_commit(source: &MultiSource) -> Result<Self, Error>
Tries to create commitment to a byte representation of a given message.
impl Eq for MerkleTree
impl StrictProduct for MerkleTree
impl StructuralPartialEq for MerkleTree
Auto Trait Implementations§
impl Freeze for MerkleTree
impl RefUnwindSafe for MerkleTree
impl Send for MerkleTree
impl Sync for MerkleTree
impl Unpin for MerkleTree
impl UnwindSafe for MerkleTree
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CommitId for Twhere
T: CommitEncode,
impl<T> CommitId for Twhere
T: CommitEncode,
fn commit(&self) -> CommitEngine
Source§fn commit_id(&self) -> <T as CommitEncode>::CommitmentId
fn commit_id(&self) -> <T as CommitEncode>::CommitmentId
Performs commitment to client-side-validated data
Source§impl<T> CommitmentLayout for Twhere
T: CommitEncode + StrictDumb,
impl<T> CommitmentLayout for Twhere
T: CommitEncode + StrictDumb,
fn commitment_layout() -> CommitLayout
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.