| 455 | } |
| 456 | |
| 457 | pub async fn confirm(&mut self, client: &AsyncClient) -> Result<Transaction, Error> { |
| 458 | let txid = self.peg_in_confirm_transaction.tx().compute_txid(); |
| 459 | verify_if_not_mined(client, txid).await?; |
| 460 | |
| 461 | let deposit_txid = self.peg_in_deposit_transaction.tx().compute_txid(); |
| 462 | let deposit_status = client.get_tx_status(&deposit_txid).await; |
| 463 | |
| 464 | match deposit_status { |
| 465 | Ok(status) => match status.confirmed { |
| 466 | true => Ok(self.peg_in_confirm_transaction.finalize()), |
| 467 | false => Err(Error::Graph(GraphError::PrecedingTxNotConfirmed(vec![ |
| 468 | NamedTx::for_tx(&self.peg_in_deposit_transaction, status.confirmed), |
| 469 | ]))), |
| 470 | }, |
| 471 | Err(e) => Err(Error::Esplora(e)), |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | pub async fn refund(&mut self, client: &AsyncClient) -> Result<Transaction, Error> { |
| 476 | let txid = self.peg_in_refund_transaction.tx().compute_txid(); |