Expand description
Anchor is a data structure used in deterministic bitcoin commitments for keeping information about the proof of the commitment in connection to the transaction which contains the commitment, and multi-protocol merkle tree as defined by LNPBP-4.
Fields
txid: TxidTransaction containing deterministic bitcoin commitment.
lnpbp4_proof: LStructured multi-protocol LNPBP-4 data the transaction commits to.
dbc_proof: ProofProof of the DBC commitment.
Implementations
sourceimpl Anchor<MerkleBlock>
impl Anchor<MerkleBlock>
sourceimpl Anchor<MerkleProof>
impl Anchor<MerkleProof>
sourcepub fn verify(
&self,
protocol_id: ProtocolId,
message: Message,
tx: Transaction
) -> Result<bool, VerifyError>
pub fn verify(
&self,
protocol_id: ProtocolId,
message: Message,
tx: Transaction
) -> Result<bool, VerifyError>
Verifies that the transaction commits to the anchor and the anchor commits to the given message under the given protocol.
sourcepub fn convolve(
&self,
protocol_id: ProtocolId,
message: Message
) -> Result<CommitmentHash, UnrelatedProof>
pub fn convolve(
&self,
protocol_id: ProtocolId,
message: Message
) -> Result<CommitmentHash, UnrelatedProof>
Verifies that the anchor commits to the given message under the given protocol.
sourceimpl Anchor<MerkleBlock>
impl Anchor<MerkleBlock>
sourcepub fn into_merkle_proof(
self,
protocol: impl Into<ProtocolId>
) -> Result<Anchor<MerkleProof>, LeafNotKnown>
pub fn into_merkle_proof(
self,
protocol: impl Into<ProtocolId>
) -> Result<Anchor<MerkleProof>, LeafNotKnown>
Conceals all LNPBP-4 data except specific protocol and converts anchor into merkle proof anchor.
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 LNPBP-4 data except specific protocol.
sourcepub fn merge_reveal(self, other: Self) -> Result<Self, MergeError>
pub fn merge_reveal(self, other: Self) -> Result<Self, MergeError>
Merges two anchors keeping revealed data.
Trait Implementations
sourceimpl CommitEncode for Anchor<MerkleBlock>
impl CommitEncode for Anchor<MerkleBlock>
sourceimpl ConsensusCommit for Anchor<MerkleBlock>
impl ConsensusCommit for Anchor<MerkleBlock>
type Commitment = AnchorId
type Commitment = AnchorId
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 Ord for Anchor<MerkleBlock>
impl Ord for Anchor<MerkleBlock>
sourceimpl PartialOrd<Anchor<MerkleBlock>> for Anchor<MerkleBlock>
impl PartialOrd<Anchor<MerkleBlock>> for Anchor<MerkleBlock>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> 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<L: Proof> StrictDecode for Anchor<L>
impl<L: Proof> StrictDecode for Anchor<L>
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<L: Proof> StrictEncode for Anchor<L>
impl<L: Proof> StrictEncode for Anchor<L>
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<L: Eq + Proof> Eq for Anchor<L>
impl<L: Proof> StructuralEq for Anchor<L>
impl<L: Proof> StructuralPartialEq for Anchor<L>
Auto Trait Implementations
impl<L> RefUnwindSafe for Anchor<L> where
L: RefUnwindSafe,
impl<L> Send for Anchor<L> where
L: Send,
impl<L> Sync for Anchor<L> where
L: Sync,
impl<L> Unpin for Anchor<L> where
L: Unpin,
impl<L> UnwindSafe for Anchor<L> where
L: UnwindSafe,
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