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

Method new_for_validation

bridge/src/transactions/disprove.rs:92–145  ·  view source on GitHub ↗
(
        network: Network,
        connector_5: &Connector5,
        connector_c: &ConnectorC,
        input_0: Input,
        input_1: Input,
    )

Source from the content-addressed store, hash-verified

90 }
91
92 pub fn new_for_validation(
93 network: Network,
94 connector_5: &Connector5,
95 connector_c: &ConnectorC,
96 input_0: Input,
97 input_1: Input,
98 ) -> Self {
99 let input_0_leaf = 1;
100 let _input_0 = connector_5.generate_taproot_leaf_tx_in(input_0_leaf, &input_0);
101
102 let _input_1 = generate_default_tx_in(&input_1);
103
104 let total_output_amount =
105 input_0.amount + input_1.amount - Amount::from_sat(MIN_RELAY_FEE_DISPROVE);
106
107 let output_0_amount = total_output_amount / 2;
108 let _output_0 = TxOut {
109 value: output_0_amount,
110 script_pubkey: generate_burn_script_address(network).script_pubkey(),
111 };
112
113 let reward_output_amount = total_output_amount - output_0_amount;
114 let _output_1 = TxOut {
115 value: reward_output_amount,
116 script_pubkey: ScriptBuf::default(),
117 };
118
119 DisproveTransaction {
120 tx: Transaction {
121 version: bitcoin::transaction::Version(2),
122 lock_time: absolute::LockTime::ZERO,
123 input: vec![_input_0, _input_1],
124 output: vec![_output_0, _output_1],
125 },
126 prev_outs: vec![
127 TxOut {
128 value: input_0.amount,
129 script_pubkey: connector_5.generate_taproot_address().script_pubkey(),
130 },
131 TxOut {
132 value: input_1.amount,
133 script_pubkey: connector_c.generate_taproot_address().script_pubkey(),
134 },
135 ],
136 prev_scripts: vec![
137 connector_5.generate_taproot_leaf_script(input_0_leaf),
138 // `input_1` prev_script is not known at this point
139 ],
140 reward_output_amount,
141 musig2_nonces: HashMap::new(),
142 musig2_nonce_signatures: HashMap::new(),
143 musig2_signatures: HashMap::new(),
144 }
145 }
146
147 fn sign_input_0(
148 &mut self,

Callers

nothing calls this directly

Calls 3

generate_default_tx_inFunction · 0.85

Tested by

no test coverage detected