pub struct Anchor<L: Proof + StrictDumb> {
pub txid: Txid,
pub mpc_proof: L,
pub dbc_proof: Proof,
}
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: Txid
Transaction containing deterministic bitcoin commitment.
mpc_proof: L
Structured multi-protocol LNPBP-4 data the transaction commits to.
dbc_proof: Proof
Proof of the DBC commitment.
Implementations§
source§impl Anchor<MerkleBlock>
impl Anchor<MerkleBlock>
source§impl Anchor<MerkleProof>
impl Anchor<MerkleProof>
sourcepub fn anchor_id(
&self,
protocol_id: impl Into<ProtocolId>,
message: Message
) -> Result<AnchorId, InvalidProof>
pub fn anchor_id( &self, protocol_id: impl Into<ProtocolId>, message: Message ) -> Result<AnchorId, InvalidProof>
Returns id of the anchor (commitment hash).
sourcepub fn into_merkle_block(
self,
protocol_id: impl Into<ProtocolId>,
message: Message
) -> Result<Anchor<MerkleBlock>, InvalidProof>
pub fn into_merkle_block( self, protocol_id: impl Into<ProtocolId>, message: Message ) -> Result<Anchor<MerkleBlock>, InvalidProof>
Reconstructs anchor containing merkle block
sourcepub fn to_merkle_block(
&self,
protocol_id: impl Into<ProtocolId>,
message: Message
) -> Result<Anchor<MerkleBlock>, InvalidProof>
pub fn to_merkle_block( &self, protocol_id: impl Into<ProtocolId>, message: Message ) -> Result<Anchor<MerkleBlock>, InvalidProof>
Reconstructs anchor containing merkle block
sourcepub fn verify(
&self,
protocol_id: impl Into<ProtocolId>,
message: Message,
tx: &Tx
) -> Result<bool, VerifyError>
pub fn verify( &self, protocol_id: impl Into<ProtocolId>, message: Message, tx: &Tx ) -> 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: impl Into<ProtocolId>,
message: Message
) -> Result<Commitment, InvalidProof>
pub fn convolve( &self, protocol_id: impl Into<ProtocolId>, message: Message ) -> Result<Commitment, InvalidProof>
Verifies that the anchor commits to the given message under the given protocol.
source§impl Anchor<MerkleBlock>
impl Anchor<MerkleBlock>
sourcepub fn to_merkle_proof(
&self,
protocol: impl Into<ProtocolId>
) -> Result<Anchor<MerkleProof>, LeafNotKnown>
pub fn to_merkle_proof( &self, protocol: impl Into<ProtocolId> ) -> Result<Anchor<MerkleProof>, LeafNotKnown>
Conceals all LNPBP-4 data except specific protocol and produces merkle proof anchor.
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§
source§impl<L: Proof + StrictDumb> CommitEncode for Anchor<L>
impl<L: Proof + StrictDumb> CommitEncode for Anchor<L>
source§fn commit_encode(&self, e: &mut impl Write)
fn commit_encode(&self, e: &mut impl Write)
io::Write
writer instancesource§impl CommitmentId for Anchor<MerkleBlock>
impl CommitmentId for Anchor<MerkleBlock>
source§impl<'de, L> Deserialize<'de> for Anchor<L>
impl<'de, L> Deserialize<'de> for Anchor<L>
source§fn 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>,
source§impl Ord for Anchor<MerkleBlock>
impl Ord for Anchor<MerkleBlock>
source§impl<L: PartialEq + Proof + StrictDumb> PartialEq for Anchor<L>
impl<L: PartialEq + Proof + StrictDumb> PartialEq for Anchor<L>
source§impl PartialOrd for Anchor<MerkleBlock>
impl PartialOrd for Anchor<MerkleBlock>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<L: Proof + StrictDumb> StrictDecode for Anchor<L>
impl<L: Proof + StrictDumb> StrictDecode for Anchor<L>
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(lim: usize, reader: impl Read) -> Result<Self, DecodeError>
source§impl<L: Proof + StrictDumb> StrictDumb for Anchor<L>
impl<L: Proof + StrictDumb> StrictDumb for Anchor<L>
fn strict_dumb() -> Self
source§impl<L: Proof + StrictDumb> StrictEncode for Anchor<L>
impl<L: Proof + StrictDumb> StrictEncode for Anchor<L>
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, lim: usize, writer: impl Write) -> Result<usize, Error>
source§impl<L: Proof + StrictDumb> StrictStruct for Anchor<L>
impl<L: Proof + StrictDumb> StrictStruct for Anchor<L>
const ALL_FIELDS: &'static [&'static str] = _
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
source§impl<L: Proof + StrictDumb> StrictType for Anchor<L>
impl<L: Proof + StrictDumb> StrictType for Anchor<L>
const STRICT_LIB_NAME: &'static str = LIB_NAME_BPCORE
fn strict_name() -> Option<TypeName>
impl<L: Eq + Proof + StrictDumb> Eq for Anchor<L>
impl<L: Proof + StrictDumb> StrictProduct for Anchor<L>
impl<L: Proof + StrictDumb> StructuralEq for Anchor<L>
impl<L: Proof + StrictDumb> 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§
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.