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

Method assert_commit_1

bridge/src/graphs/peg_out.rs:1735–1761  ·  view source on GitHub ↗
(
        &mut self,
        client: &AsyncClient,
        commitment_secrets: &HashMap<CommitmentMessageId, WinternitzSecret>,
        proof: &RawProof,
    )

Source from the content-addressed store, hash-verified

1733 }
1734
1735 pub async fn assert_commit_1(
1736 &mut self,
1737 client: &AsyncClient,
1738 commitment_secrets: &HashMap<CommitmentMessageId, WinternitzSecret>,
1739 proof: &RawProof,
1740 ) -> Result<Transaction, Error> {
1741 verify_if_not_mined(client, self.assert_commit_1_transaction.tx().compute_txid()).await?;
1742
1743 let assert_initial_txid = self.assert_initial_transaction.tx().compute_txid();
1744 let assert_initial_status = client.get_tx_status(&assert_initial_txid).await;
1745
1746 match assert_initial_status {
1747 Ok(status) => match status.confirmed {
1748 true => {
1749 let (witness_for_commit1, _) =
1750 sign_assert_tx_with_groth16_proof(commitment_secrets, proof);
1751 self.assert_commit_1_transaction
1752 .sign(&self.connector_e_1, witness_for_commit1);
1753 Ok(self.assert_commit_1_transaction.finalize())
1754 }
1755 false => Err(Error::Graph(GraphError::PrecedingTxNotConfirmed(vec![
1756 NamedTx::for_tx(&self.assert_initial_transaction, status.confirmed),
1757 ]))),
1758 },
1759 Err(e) => Err(Error::Esplora(e)),
1760 }
1761 }
1762
1763 pub async fn assert_commit_2(
1764 &mut self,

Callers 1

Calls 5

verify_if_not_minedFunction · 0.85
txMethod · 0.45
signMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected