pub struct Anchor<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod = Method> {
pub mpc_proof: L,
pub dbc_proof: D,
pub method: M,
}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§
§mpc_proof: LStructured multi-protocol LNPBP-4 data the transaction commits to.
dbc_proof: DProof of the DBC commitment.
method: MMethod used by the anchor
Implementations§
source§impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> Anchor<L, D, M>
impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> Anchor<L, D, M>
sourcepub fn new(mpc_proof: L, dbc_proof: D) -> Self
pub fn new(mpc_proof: L, dbc_proof: D) -> Self
Constructs anchor for a given witness transaction id, MPC and DBC proofs.
sourcepub fn matches(&self, other: &Self) -> bool
pub fn matches(&self, other: &Self) -> bool
Verifies whether one anchor matches another ancor.
This is not the same as Eq, since two anchors may reveal different
messages in their MPC proofs, and this be non-equivalent, at the same
time matching each other , i.e. having the same merkle root and
producing the same commitments.
source§impl<D: Proof<M>, M: DbcMethod> Anchor<MerkleProof, D, M>
impl<D: Proof<M>, M: DbcMethod> Anchor<MerkleProof, D, M>
sourcepub fn into_merkle_block(
self,
protocol_id: impl Into<ProtocolId>,
message: impl Into<Message>,
) -> Result<Anchor<MerkleBlock, D, M>, InvalidProof>
pub fn into_merkle_block( self, protocol_id: impl Into<ProtocolId>, message: impl Into<Message>, ) -> Result<Anchor<MerkleBlock, D, M>, InvalidProof>
Reconstructs anchor containing merkle block
sourcepub fn to_merkle_block(
&self,
protocol_id: impl Into<ProtocolId>,
message: impl Into<Message>,
) -> Result<Anchor<MerkleBlock, D, M>, InvalidProof>
pub fn to_merkle_block( &self, protocol_id: impl Into<ProtocolId>, message: impl Into<Message>, ) -> Result<Anchor<MerkleBlock, D, M>, InvalidProof>
Reconstructs anchor containing merkle block
sourcepub fn verify(
&self,
protocol_id: impl Into<ProtocolId>,
message: impl Into<Message>,
tx: &Tx,
) -> Result<Commitment, VerifyError<D::Error>>
pub fn verify( &self, protocol_id: impl Into<ProtocolId>, message: impl Into<Message>, tx: &Tx, ) -> Result<Commitment, VerifyError<D::Error>>
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: impl Into<Message>,
) -> Result<Commitment, InvalidProof>
pub fn convolve( &self, protocol_id: impl Into<ProtocolId>, message: impl Into<Message>, ) -> Result<Commitment, InvalidProof>
Verifies that the anchor commits to the given message under the given protocol.
source§impl<D: Proof<M>, M: DbcMethod> Anchor<MerkleBlock, D, M>
impl<D: Proof<M>, M: DbcMethod> Anchor<MerkleBlock, D, M>
sourcepub fn to_merkle_proof(
&self,
protocol: impl Into<ProtocolId>,
) -> Result<Anchor<MerkleProof, D, M>, LeafNotKnown>
pub fn to_merkle_proof( &self, protocol: impl Into<ProtocolId>, ) -> Result<Anchor<MerkleProof, D, M>, 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, D, M>, LeafNotKnown>
pub fn into_merkle_proof( self, protocol: impl Into<ProtocolId>, ) -> Result<Anchor<MerkleProof, D, M>, 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: Clone + Proof + StrictDumb, D: Clone + Proof<M>, M: Clone + DbcMethod> Clone for Anchor<L, D, M>
impl<L: Clone + Proof + StrictDumb, D: Clone + Proof<M>, M: Clone + DbcMethod> Clone for Anchor<L, D, M>
source§impl<L: Debug + Proof + StrictDumb, D: Debug + Proof<M>, M: Debug + DbcMethod> Debug for Anchor<L, D, M>
impl<L: Debug + Proof + StrictDumb, D: Debug + Proof<M>, M: Debug + DbcMethod> Debug for Anchor<L, D, M>
source§impl<'de, L, D, M> Deserialize<'de> for Anchor<L, D, M>where
L: Deserialize<'de> + Proof + StrictDumb,
D: Deserialize<'de> + Proof<M>,
M: Deserialize<'de> + DbcMethod,
impl<'de, L, D, M> Deserialize<'de> for Anchor<L, D, M>where
L: Deserialize<'de> + Proof + StrictDumb,
D: Deserialize<'de> + Proof<M>,
M: Deserialize<'de> + DbcMethod,
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<L: Hash + Proof + StrictDumb, D: Hash + Proof<M>, M: Hash + DbcMethod> Hash for Anchor<L, D, M>
impl<L: Hash + Proof + StrictDumb, D: Hash + Proof<M>, M: Hash + DbcMethod> Hash for Anchor<L, D, M>
source§impl<L: Ord + Proof + StrictDumb, D: Ord + Proof<M>, M: Ord + DbcMethod> Ord for Anchor<L, D, M>
impl<L: Ord + Proof + StrictDumb, D: Ord + Proof<M>, M: Ord + DbcMethod> Ord for Anchor<L, D, M>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<L: PartialEq + Proof + StrictDumb, D: PartialEq + Proof<M>, M: PartialEq + DbcMethod> PartialEq for Anchor<L, D, M>
impl<L: PartialEq + Proof + StrictDumb, D: PartialEq + Proof<M>, M: PartialEq + DbcMethod> PartialEq for Anchor<L, D, M>
source§impl<L: PartialOrd + Proof + StrictDumb, D: PartialOrd + Proof<M>, M: PartialOrd + DbcMethod> PartialOrd for Anchor<L, D, M>
impl<L: PartialOrd + Proof + StrictDumb, D: PartialOrd + Proof<M>, M: PartialOrd + DbcMethod> PartialOrd for Anchor<L, D, M>
source§impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> StrictDecode for Anchor<L, D, M>
impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> StrictDecode for Anchor<L, D, M>
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
source§impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> StrictDumb for Anchor<L, D, M>
impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> StrictDumb for Anchor<L, D, M>
fn strict_dumb() -> Self
source§impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> StrictEncode for Anchor<L, D, M>
impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> StrictEncode for Anchor<L, D, M>
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
source§impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> StrictStruct for Anchor<L, D, M>
impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> StrictStruct for Anchor<L, D, M>
const ALL_FIELDS: &'static [&'static str] = _
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
source§impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> StrictType for Anchor<L, D, M>
impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> StrictType for Anchor<L, D, M>
const STRICT_LIB_NAME: &'static str = LIB_NAME_BPCORE
fn strict_name() -> Option<TypeName>
impl<L: Eq + Proof + StrictDumb, D: Eq + Proof<M>, M: Eq + DbcMethod> Eq for Anchor<L, D, M>
impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> StrictProduct for Anchor<L, D, M>
impl<L: Proof + StrictDumb, D: Proof<M>, M: DbcMethod> StructuralPartialEq for Anchor<L, D, M>
Auto Trait Implementations§
impl<L, D, M> Freeze for Anchor<L, D, M>
impl<L, D, M> RefUnwindSafe for Anchor<L, D, M>
impl<L, D, M> Send for Anchor<L, D, M>
impl<L, D, M> Sync for Anchor<L, D, M>
impl<L, D, M> Unpin for Anchor<L, D, M>
impl<L, D, M> UnwindSafe for Anchor<L, D, M>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
key and return true if they are equal.