Skip to content

Instantly share code, notes, and snippets.

@sanket1729
Last active December 21, 2020 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanket1729/2e1bf9f2a1bae326f75ebcf983a369ce to your computer and use it in GitHub Desktop.
Save sanket1729/2e1bf9f2a1bae326f75ebcf983a369ce to your computer and use it in GitHub Desktop.
fn witness_script<ToPkCtx: Copy>(&self, to_pk_ctx: ToPkCtx) -> BtcScript
where
Pk: ToPublicKey<ToPkCtx>,
{
let tweak = self.desc.witness_script(to_pk_ctx).into_bytes();
let mut builder = script::Builder::new()
.push_opcode(opcodes::all::OP_DEPTH)
.push_int(self.fed_k as i64 + 1)
.push_opcode(opcodes::all::OP_EQUAL)
.push_opcode(opcodes::all::OP_IF)
.push_int(self.fed_k as i64);
for key in &self.fed_pks {
// Typing error here:
let tweaked_pk = key.to_public_key((to_pk_ctx, &tweak));
//^^^^^^^^^^^^^^^^^^^ expected type parameter `ToPkCtx`, found tuple
builder = builder.push_key(&tweaked_pk);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment