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

Function create_and_mine_assert_initial_tx

bridge/tests/bridge/assert/helper.rs:59–93  ·  view source on GitHub ↗
(
    esplora: &AsyncClient,
    network: Network,
    verifier_0_context: &VerifierContext,
    verifier_1_context: &VerifierContext,
    connector_b: &ConnectorB,
    connector_d: &ConnectorD,
    a

Source from the content-addressed store, hash-verified

57}
58
59pub async fn create_and_mine_assert_initial_tx(
60 esplora: &AsyncClient,
61 network: Network,
62 verifier_0_context: &VerifierContext,
63 verifier_1_context: &VerifierContext,
64 connector_b: &ConnectorB,
65 connector_d: &ConnectorD,
66 assert_commit_connectors_e_1: &AssertCommit1ConnectorsE,
67 assert_commit_connectors_e_2: &AssertCommit2ConnectorsE,
68 input: Input,
69) -> (Transaction, Txid) {
70 let mut assert_initial_tx = AssertInitialTransaction::new(
71 connector_b,
72 connector_d,
73 assert_commit_connectors_e_1,
74 assert_commit_connectors_e_2,
75 input,
76 );
77
78 let secret_nonces_0 = assert_initial_tx.push_nonces(verifier_0_context);
79 let secret_nonces_1 = assert_initial_tx.push_nonces(verifier_1_context);
80
81 assert_initial_tx.pre_sign(verifier_0_context, connector_b, &secret_nonces_0);
82 assert_initial_tx.pre_sign(verifier_1_context, connector_b, &secret_nonces_1);
83
84 let tx = assert_initial_tx.finalize();
85 let tx_id = tx.compute_txid();
86 println!("Txid: {:?}", tx_id);
87 wait_for_timelock_expiry(network, Some("kick off 2 connector b")).await;
88 let result = esplora.broadcast(&tx).await;
89 println!("Assert initial tx result: {:?}\n", result);
90 assert!(result.is_ok());
91
92 (tx, tx_id)
93}

Callers 2

test_disprove_successFunction · 0.85

Calls 4

wait_for_timelock_expiryFunction · 0.85
push_noncesMethod · 0.80
pre_signMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected