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

Function test_assert_final_tx_success

bridge/tests/bridge/assert/assert_final.rs:22–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21#[tokio::test]
22async fn test_assert_final_tx_success() {
23 let config = setup_test_full().await;
24 let faucet = Faucet::new(FaucetType::EsploraRegtest);
25
26 let mut funding_inputs: Vec<(&Address, Amount)> = vec![];
27 let reward_amount = get_reward_amount(ONE_HUNDRED);
28 // not adding assert final relay fee since hundreds of dust will cover it
29 let input_value0 = Amount::from_sat(reward_amount);
30 let funding_utxo_address0 = config.connector_d.generate_taproot_address();
31 funding_inputs.push((&funding_utxo_address0, input_value0));
32 let assert_commit1_dust_amount =
33 config.assert_commit_connectors_e_1.connectors_num() as u64 * DUST_AMOUNT;
34 let input_value1 = Amount::from_sat(assert_commit1_dust_amount);
35 let funding_utxo_address1 = config
36 .assert_commit_connectors_f
37 .connector_f_1
38 .generate_address();
39 funding_inputs.push((&funding_utxo_address1, input_value1));
40 let assert_commit2_dust_amount =
41 config.assert_commit_connectors_e_2.connectors_num() as u64 * DUST_AMOUNT;
42 let input_value2 = Amount::from_sat(assert_commit2_dust_amount);
43 let funding_utxo_address2 = config
44 .assert_commit_connectors_f
45 .connector_f_2
46 .generate_address();
47 funding_inputs.push((&funding_utxo_address2, input_value2));
48 faucet
49 .fund_inputs(&config.client_0, &funding_inputs)
50 .await
51 .wait()
52 .await;
53
54 verify_funding_inputs(&config.client_0, &funding_inputs).await;
55
56 let funding_outpoint0 =
57 generate_stub_outpoint(&config.client_0, &funding_utxo_address0, input_value0).await;
58 let funding_outpoint1 =
59 generate_stub_outpoint(&config.client_0, &funding_utxo_address1, input_value1).await;
60 let funding_outpoint2 =
61 generate_stub_outpoint(&config.client_0, &funding_utxo_address2, input_value2).await;
62
63 let mut assert_final_tx = AssertFinalTransaction::new(
64 &config.operator_context,
65 &config.connector_4,
66 &config.connector_5,
67 &config.connector_c,
68 &config.connector_d,
69 &config.assert_commit_connectors_f,
70 Input {
71 outpoint: funding_outpoint0,
72 amount: input_value0,
73 },
74 Input {
75 outpoint: funding_outpoint1,
76 amount: input_value1,
77 },
78 Input {
79 outpoint: funding_outpoint2,

Callers

nothing calls this directly

Calls 14

setup_test_fullFunction · 0.85
get_reward_amountFunction · 0.85
verify_funding_inputsFunction · 0.85
generate_stub_outpointFunction · 0.85
check_tx_output_sumFunction · 0.85
connectors_numMethod · 0.80
waitMethod · 0.80
fund_inputsMethod · 0.80
push_noncesMethod · 0.80
pushMethod · 0.45
generate_addressMethod · 0.45

Tested by

no test coverage detected