Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include closing method in anchor #85

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions dbc/src/anchor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
//! defined by LNPBP-4.

use std::error::Error;
use std::marker::PhantomData;

use bc::Tx;
use commit_verify::mpc::{self, Message, ProtocolId};
Expand Down Expand Up @@ -74,19 +73,18 @@ pub struct Anchor<L: mpc::Proof + StrictDumb, D: dbc::Proof<M>, M: DbcMethod = M
/// Proof of the DBC commitment.
pub dbc_proof: D,

#[doc(hidden)]
#[strict_type(skip)]
pub _method: PhantomData<M>,
/// Method used by the anchor
pub method: M,
}

impl<L: mpc::Proof + StrictDumb, D: dbc::Proof<M>, M: DbcMethod> Anchor<L, D, M> {
/// Constructs anchor for a given witness transaction id, MPC and DBC
/// proofs.
pub fn new(mpc_proof: L, dbc_proof: D) -> Self {
pub fn new(mpc_proof: L, dbc_proof: D, method: M) -> Self {
Self {
mpc_proof,
dbc_proof,
_method: PhantomData,
method,
}
}
}
Expand Down Expand Up @@ -116,7 +114,7 @@ impl<D: dbc::Proof<M>, M: DbcMethod> Anchor<mpc::MerkleProof, D, M> {
Ok(Anchor {
mpc_proof: lnpbp4_proof,
dbc_proof: self.dbc_proof,
_method: default!(),
method: self.method,
})
}

Expand Down Expand Up @@ -175,7 +173,7 @@ impl<D: dbc::Proof<M>, M: DbcMethod> Anchor<mpc::MerkleBlock, D, M> {
Ok(Anchor {
mpc_proof: lnpbp4_proof,
dbc_proof: self.dbc_proof,
_method: default!(),
method: self.method,
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/stl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use strict_types::{CompileError, LibBuilder, TypeLib};
/// Strict types id for the library providing data types from [`dbc`] and
/// [`seals`] crates.
pub const LIB_ID_BPCORE: &str =
"urn:ubideco:stl:6skrch4mJzDzVaTYnCgCxFJLw23SSUxNhK7PKgPdSapR#roof-parent-reunion";
"urn:ubideco:stl:C5EbVby4rry8esHwoPrGUfhe7yqJgoyA1DBcyuBRf2rZ#granite-target-table";

fn _bp_core_stl() -> Result<TypeLib, CompileError> {
LibBuilder::new(libname!(LIB_NAME_BPCORE), tiny_bset! {
Expand Down