(
&mut self,
client: &AsyncClient,
commitment_secrets: &HashMap<CommitmentMessageId, WinternitzSecret>,
proof: &RawProof,
)
| 1761 | } |
| 1762 | |
| 1763 | pub async fn assert_commit_2( |
| 1764 | &mut self, |
| 1765 | client: &AsyncClient, |
| 1766 | commitment_secrets: &HashMap<CommitmentMessageId, WinternitzSecret>, |
| 1767 | proof: &RawProof, |
| 1768 | ) -> Result<Transaction, Error> { |
| 1769 | verify_if_not_mined(client, self.assert_commit_2_transaction.tx().compute_txid()).await?; |
| 1770 | |
| 1771 | let assert_initial_txid = self.assert_initial_transaction.tx().compute_txid(); |
| 1772 | let assert_initial_status = client.get_tx_status(&assert_initial_txid).await; |
| 1773 | |
| 1774 | match assert_initial_status { |
| 1775 | Ok(status) => match status.confirmed { |
| 1776 | true => { |
| 1777 | let (_, witness_for_commit2) = |
| 1778 | sign_assert_tx_with_groth16_proof(commitment_secrets, proof); |
| 1779 | self.assert_commit_2_transaction |
| 1780 | .sign(&self.connector_e_2, witness_for_commit2); |
| 1781 | Ok(self.assert_commit_2_transaction.finalize()) |
| 1782 | } |
| 1783 | false => Err(Error::Graph(GraphError::PrecedingTxNotConfirmed(vec![ |
| 1784 | NamedTx::for_tx(&self.assert_initial_transaction, status.confirmed), |
| 1785 | ]))), |
| 1786 | }, |
| 1787 | Err(e) => Err(Error::Esplora(e)), |
| 1788 | } |
| 1789 | } |
| 1790 | |
| 1791 | // use this when possible |
| 1792 | // return both commit1 and commit2, will save time for verifying groth16 |
no test coverage detected