Skip to content

Commit

Permalink
finish to implement get_bitcoin_satisfaction
Browse files Browse the repository at this point in the history
  • Loading branch information
RCasatta committed Aug 7, 2024
1 parent 81b25cd commit 937d7e8
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/descriptor/pegin/dynafed_pegin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,26 +216,25 @@ impl<Pk: MiniscriptKey> Pegin<Pk> {
/// construct one using the satisfier S.
pub fn get_bitcoin_satisfaction<S, C: secp256k1_zkp::Verification>(
&self,
_secp: &secp256k1_zkp::Secp256k1<C>,
_satisfier: S,
secp: &secp256k1_zkp::Secp256k1<C>,
satisfier: S,
) -> Result<(Vec<Vec<u8>>, BtcScript), Error>
where
S: BtcSatisfier<bitcoin::PublicKey>,
Pk: ToPublicKey,
{
let tweak_vec = self
let claim_script = self
.elem_desc
.explicit_script()
.expect("Tr pegins unknown yet")
.into_bytes();
let _tweak = hashes::sha256::Hash::hash(&tweak_vec);
unreachable!("TODO: After upstream refactor");
// let tweaked_desc = self.fed_desc.translate_pk_infallible(
// |pk| tweak_key(pk, secp, tweak.as_inner()),
// |_| unreachable!("No keyhashes in elements descriptors"),
// );
// let res = tweaked_desc.get_satisfaction(satisfier)?;
// Ok(res)
let mut t = TranslateTweak(&claim_script[..], secp);

let tweaked_desc = bitcoin_miniscript::TranslatePk::translate_pk(&self.fed_desc, &mut t)
.expect("Tweaking must succeed");

let res = tweaked_desc.get_satisfaction(satisfier)?;
Ok(res)
}

/// Computes an upper bound on the weight of a satisfying witness to the
Expand Down

0 comments on commit 937d7e8

Please sign in to comment.