Struct commit_verify::lnpbp4::MerkleBlock
source · [−]pub struct MerkleBlock { /* private fields */ }Expand description
Partially-concealed merkle tree data.
Implementations
sourceimpl MerkleBlock
impl MerkleBlock
sourcepub fn depth(&self) -> u8
pub fn depth(&self) -> u8
Method returning copy of MerkleBlock::depth field.
Tree depth (up to 16).
sourcepub fn entropy(&self) -> Option<u64>
pub fn entropy(&self) -> Option<u64>
Method returning copy of MerkleBlock::entropy field.
Entropy used for placeholders. May be unknown if the message is not
sourceimpl MerkleBlock
impl MerkleBlock
sourcepub fn with(
proof: &MerkleProof,
protocol_id: ProtocolId,
message: Message
) -> Result<Self, UnrelatedProof>
pub fn with(
proof: &MerkleProof,
protocol_id: ProtocolId,
message: Message
) -> Result<Self, UnrelatedProof>
Constructs merkle block from a merkle proof
sourcepub fn conceal_except(
&mut self,
protocols: impl AsRef<[ProtocolId]>
) -> Result<usize, LeafNotKnown>
pub fn conceal_except(
&mut self,
protocols: impl AsRef<[ProtocolId]>
) -> Result<usize, LeafNotKnown>
Conceals all commitments in the block except for the commitment under
given protocol_ids. Also removes information about the entropy value
used.
Returns
Number of concealed nodes.
Error
If leaf with the given protocol_id is not found (absent or already
concealed), errors with LeafNotKnown error.
sourcepub fn merge_reveal_path(
&mut self,
proof: &MerkleProof,
protocol_id: ProtocolId,
message: Message
) -> Result<u16, UnrelatedProof>
pub fn merge_reveal_path(
&mut self,
proof: &MerkleProof,
protocol_id: ProtocolId,
message: Message
) -> Result<u16, UnrelatedProof>
Merges information from the given proof to the merkle block, revealing
path related to te commitment to the message under the given
protocol_id.
sourcepub fn merge_reveal(
&mut self,
other: MerkleBlock
) -> Result<u16, UnrelatedProof>
pub fn merge_reveal(
&mut self,
other: MerkleBlock
) -> Result<u16, UnrelatedProof>
Merges two merkle blocks together, joining revealed information from each one of them.
sourcepub fn into_merkle_proof(
self,
protocol_id: ProtocolId
) -> Result<MerkleProof, LeafNotKnown>
pub fn into_merkle_proof(
self,
protocol_id: ProtocolId
) -> Result<MerkleProof, LeafNotKnown>
Converts the merkle block into a merkle proof for the inclusion of a
commitment under given protocol_id.
sourcepub fn to_merkle_proof(
&self,
protocol_id: ProtocolId
) -> Result<MerkleProof, LeafNotKnown>
pub fn to_merkle_proof(
&self,
protocol_id: ProtocolId
) -> Result<MerkleProof, LeafNotKnown>
Constructs merkle proof for the inclusion of a commitment under given
protocol_id for the current Merkle block.
sourcepub fn protocol_id_pos(&self, protocol_id: ProtocolId) -> u16
pub fn protocol_id_pos(&self, protocol_id: ProtocolId) -> u16
Computes position for a given protocol_id within the tree leaves.
Trait Implementations
sourceimpl Clone for MerkleBlock
impl Clone for MerkleBlock
sourcefn clone(&self) -> MerkleBlock
fn clone(&self) -> MerkleBlock
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl CommitConceal for MerkleBlock
impl CommitConceal for MerkleBlock
sourcefn commit_conceal(&self) -> Self::ConcealedCommitment
fn commit_conceal(&self) -> Self::ConcealedCommitment
Reduces merkle tree into merkle tree root.
type ConcealedCommitment = MerkleNode
type ConcealedCommitment = MerkleNode
The resulting confidential type concealing and committing to the original data Read more
sourceimpl CommitEncode for MerkleBlock
impl CommitEncode for MerkleBlock
sourceimpl ConsensusCommit for MerkleBlock
impl ConsensusCommit for MerkleBlock
type Commitment = CommitmentHash
type Commitment = CommitmentHash
Type of the resulting commitment
sourcefn consensus_commit(&self) -> Self::Commitment
fn consensus_commit(&self) -> Self::Commitment
Performs commitment to client-side-validated data
sourcefn consensus_verify(&self, commitment: &Self::Commitment) -> bool
fn consensus_verify(&self, commitment: &Self::Commitment) -> bool
Verifies commitment to client-side-validated data
sourceimpl Debug for MerkleBlock
impl Debug for MerkleBlock
sourceimpl Default for MerkleBlock
impl Default for MerkleBlock
sourcefn default() -> MerkleBlock
fn default() -> MerkleBlock
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for MerkleBlock
impl<'de> Deserialize<'de> for MerkleBlock
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<&'_ MerkleTree> for MerkleBlock
impl From<&'_ MerkleTree> for MerkleBlock
sourcefn from(tree: &MerkleTree) -> Self
fn from(tree: &MerkleTree) -> Self
Converts to this type from the input type.
sourceimpl From<MerkleTree> for MerkleBlock
impl From<MerkleTree> for MerkleBlock
sourcefn from(tree: MerkleTree) -> Self
fn from(tree: MerkleTree) -> Self
Converts to this type from the input type.
sourceimpl Hash for MerkleBlock
impl Hash for MerkleBlock
sourceimpl IntoIterator for &MerkleBlock
impl IntoIterator for &MerkleBlock
sourceimpl Ord for MerkleBlock
impl Ord for MerkleBlock
sourceimpl PartialEq<MerkleBlock> for MerkleBlock
impl PartialEq<MerkleBlock> for MerkleBlock
sourcefn eq(&self, other: &MerkleBlock) -> bool
fn eq(&self, other: &MerkleBlock) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &MerkleBlock) -> bool
fn ne(&self, other: &MerkleBlock) -> bool
This method tests for !=.
sourceimpl PartialOrd<MerkleBlock> for MerkleBlock
impl PartialOrd<MerkleBlock> for MerkleBlock
sourcefn partial_cmp(&self, other: &MerkleBlock) -> Option<Ordering>
fn partial_cmp(&self, other: &MerkleBlock) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
sourceimpl Serialize for MerkleBlock
impl Serialize for MerkleBlock
sourceimpl StrictDecode for MerkleBlock
impl StrictDecode for MerkleBlock
sourcefn strict_decode<D: Read>(d: D) -> Result<Self, Error>
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
Decode with the given std::io::Read instance; must either
construct an instance or return implementation-specific error type. Read more
sourcefn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
Tries to deserialize byte array into the current type using
StrictDecode::strict_decode Read more
sourceimpl StrictEncode for MerkleBlock
impl StrictEncode for MerkleBlock
sourcefn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
fn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
Encode with the given std::io::Write instance; must return result
with either amount of bytes encoded – or implementation-specific
error type. Read more
sourcefn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
fn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
Serializes data as a byte array using StrictEncode::strict_encode
function Read more
impl Eq for MerkleBlock
impl Proof for MerkleBlock
impl StructuralEq for MerkleBlock
impl StructuralPartialEq for MerkleBlock
Auto Trait Implementations
impl RefUnwindSafe for MerkleBlock
impl Send for MerkleBlock
impl Sync for MerkleBlock
impl Unpin for MerkleBlock
impl UnwindSafe for MerkleBlock
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key and return true if they are equal.