| 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(); |
| 477 | verify_if_not_mined(client, txid).await?; |
| 478 | |
| 479 | let deposit_txid = self.peg_in_deposit_transaction.tx().compute_txid(); |
| 480 | let deposit_status = client.get_tx_status(&deposit_txid).await; |
| 481 | |
| 482 | match deposit_status { |
| 483 | Ok(status) => match status.confirmed { |
| 484 | true => Ok(self.peg_in_refund_transaction.finalize()), |
| 485 | false => Err(Error::Graph(GraphError::PrecedingTxNotConfirmed(vec![ |
| 486 | NamedTx::for_tx(&self.peg_in_deposit_transaction, status.confirmed), |
| 487 | ]))), |
| 488 | }, |
| 489 | Err(e) => Err(Error::Esplora(e)), |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | async fn get_peg_in_statuses( |
| 494 | &self, |