| 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, |