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

Method new_for_validation

bridge/src/transactions/start_time_timeout.rs:90–144  ·  view source on GitHub ↗
(
        network: Network,
        connector_1: &Connector1,
        connector_2: &Connector2,
        input_0: Input,
        input_1: Input,
    )

Source from the content-addressed store, hash-verified

88 }
89
90 pub fn new_for_validation(
91 network: Network,
92 connector_1: &Connector1,
93 connector_2: &Connector2,
94 input_0: Input,
95 input_1: Input,
96 ) -> Self {
97 let input_0_leaf = 1;
98 let _input_0 = connector_2.generate_taproot_leaf_tx_in(input_0_leaf, &input_0);
99
100 let input_1_leaf = 2;
101 let _input_1 = connector_1.generate_taproot_leaf_tx_in(input_1_leaf, &input_1);
102
103 let total_output_amount =
104 input_0.amount + input_1.amount - Amount::from_sat(MIN_RELAY_FEE_START_TIME_TIMEOUT);
105
106 // Output[0]: value=V*2%*95% to burn
107 let _output_0 = TxOut {
108 value: total_output_amount * 95 / 100,
109 script_pubkey: generate_burn_script_address(network).script_pubkey(),
110 };
111
112 let reward_output_amount = total_output_amount - (total_output_amount * 95 / 100);
113 let _output_1 = TxOut {
114 value: reward_output_amount,
115 script_pubkey: ScriptBuf::default(),
116 };
117
118 StartTimeTimeoutTransaction {
119 tx: Transaction {
120 version: bitcoin::transaction::Version(2),
121 lock_time: absolute::LockTime::ZERO,
122 input: vec![_input_0, _input_1],
123 output: vec![_output_0, _output_1],
124 },
125 prev_outs: vec![
126 TxOut {
127 value: input_0.amount,
128 script_pubkey: connector_2.generate_taproot_address().script_pubkey(),
129 },
130 TxOut {
131 value: input_1.amount,
132 script_pubkey: connector_1.generate_taproot_address().script_pubkey(),
133 },
134 ],
135 prev_scripts: vec![
136 connector_2.generate_taproot_leaf_script(input_0_leaf),
137 connector_1.generate_taproot_leaf_script(input_1_leaf),
138 ],
139 reward_output_amount,
140 musig2_nonces: HashMap::new(),
141 musig2_nonce_signatures: HashMap::new(),
142 musig2_signatures: HashMap::new(),
143 }
144 }
145
146 fn sign_input_0(
147 &mut self,

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected