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

Method assert_initial

bridge/src/graphs/peg_out.rs:1705–1733  ·  view source on GitHub ↗
(&mut self, client: &AsyncClient)

Source from the content-addressed store, hash-verified

1703 }
1704
1705 pub async fn assert_initial(&mut self, client: &AsyncClient) -> Result<Transaction, Error> {
1706 verify_if_not_mined(client, self.assert_initial_transaction.tx().compute_txid()).await?;
1707
1708 let kick_off_2_txid = self.kick_off_2_transaction.tx().compute_txid();
1709 let kick_off_2_status = client.get_tx_status(&kick_off_2_txid).await;
1710
1711 let blockchain_height = client.get_height().await;
1712
1713 match kick_off_2_status {
1714 Ok(status) => match status.confirmed {
1715 true => match status.block_height {
1716 Some(block_height)
1717 if blockchain_height.is_ok_and(|height| {
1718 block_height + self.connector_b.num_blocks_timelock_1 <= height
1719 }) =>
1720 {
1721 Ok(self.assert_initial_transaction.finalize())
1722 }
1723 _ => Err(Error::Graph(GraphError::PrecedingTxTimelockNotMet(
1724 NamedTx::for_tx(&self.kick_off_2_transaction, status.confirmed),
1725 ))),
1726 },
1727 false => Err(Error::Graph(GraphError::PrecedingTxNotConfirmed(vec![
1728 NamedTx::for_tx(&self.kick_off_2_transaction, status.confirmed),
1729 ]))),
1730 },
1731 Err(e) => Err(Error::Esplora(e)),
1732 }
1733 }
1734
1735 pub async fn assert_commit_1(
1736 &mut self,

Callers 2

test_peg_out_feesFunction · 0.80

Calls 3

verify_if_not_minedFunction · 0.85
txMethod · 0.45
finalizeMethod · 0.45

Tested by 1

test_peg_out_feesFunction · 0.64