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

Method new_for_validation

bridge/src/transactions/challenge.rs:65–104  ·  view source on GitHub ↗
(
        network: Network,
        operator_public_key: &PublicKey,
        connector_a: &ConnectorA,
        input_0: Input,
        input_amount_crowdfunding: Amount,
    )

Source from the content-addressed store, hash-verified

63 }
64
65 pub fn new_for_validation(
66 network: Network,
67 operator_public_key: &PublicKey,
68 connector_a: &ConnectorA,
69 input_0: Input,
70 input_amount_crowdfunding: Amount,
71 ) -> Self {
72 let input_0_leaf = 1;
73 let _input_0 = connector_a.generate_taproot_leaf_tx_in(input_0_leaf, &input_0);
74
75 let total_output_amount =
76 input_0.amount + input_amount_crowdfunding - Amount::from_sat(MIN_RELAY_FEE_CHALLENGE);
77
78 let _output_0 = TxOut {
79 value: total_output_amount,
80 script_pubkey: generate_pay_to_pubkey_script_address(network, operator_public_key)
81 .script_pubkey(),
82 };
83
84 ChallengeTransaction {
85 tx: Transaction {
86 version: bitcoin::transaction::Version(2),
87 lock_time: absolute::LockTime::ZERO,
88 input: vec![_input_0],
89 output: vec![_output_0],
90 },
91 prev_outs: vec![
92 TxOut {
93 value: input_0.amount,
94 script_pubkey: connector_a.generate_taproot_address().script_pubkey(),
95 },
96 // input 1 will be added later
97 ],
98 prev_scripts: vec![
99 connector_a.generate_taproot_leaf_script(input_0_leaf),
100 // input 1's script will be added later
101 ],
102 input_amount_crowdfunding,
103 }
104 }
105
106 fn sign_input_0(&mut self, context: &OperatorContext, connector_a: &ConnectorA) {
107 pre_sign_taproot_input_default(

Callers

nothing calls this directly

Tested by

no test coverage detected