MCPcopy Create free account
hub / github.com/BitVM/BitVM / generate_taproot_leaf_script

Method generate_taproot_leaf_script

bridge/src/connectors/connector_e.rs:37–61  ·  view source on GitHub ↗
(&self, leaf_index: u32)

Source from the content-addressed store, hash-verified

35
36impl TaprootConnector for ConnectorE {
37 fn generate_taproot_leaf_script(&self, leaf_index: u32) -> ScriptBuf {
38 assert_eq!(leaf_index, 0, "Invalid leaf index");
39 let mut script = script! {};
40 for (message, pk) in self.commitment_public_keys.iter().rev() {
41 match message {
42 CommitmentMessageId::Groth16IntermediateValues((_, size)) => {
43 script = script.push_script(
44 script! {
45 {winternitz_message_checksig_verify(pk, *size)}
46 for _ in 0..*size {
47 OP_DROP
48 }
49 // it's must be exactly one on stack after execution
50 OP_TRUE
51 }
52 .compile(),
53 );
54 }
55 _ => {
56 panic!("connector e only reveal intermediate value of groth16")
57 }
58 }
59 }
60 script.compile()
61 }
62
63 fn generate_taproot_leaf_tx_in(&self, leaf_index: u32, input: &Input) -> TxIn {
64 assert_eq!(leaf_index, 0, "Invalid leaf index");

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected