Add is_confirmed with a TODO: Remove

Closes https://github.com/serai-dex/serai/issues/129.
This commit is contained in:
Luke Parker
2022-10-15 19:51:59 -04:00
parent e9d5fb25c8
commit 4629e88a28
3 changed files with 36 additions and 13 deletions

View File

@@ -55,6 +55,9 @@ pub trait Coin {
key: <Self::Curve as Curve>::G,
) -> Result<Vec<Self::Output>, CoinError>;
// TODO: Remove
async fn is_confirmed(&self, tx: &[u8], height: usize) -> Result<bool, CoinError>;
async fn prepare_send(
&self,
keys: FrostKeys<Self::Curve>,

View File

@@ -147,6 +147,12 @@ impl Coin for Monero {
)
}
async fn is_confirmed(&self, tx: &[u8], height: usize) -> Result<bool, CoinError> {
let tx_height =
self.rpc.get_transaction_height(tx).await.map_err(|_| CoinError::ConnectionError)?;
Ok((height.saturating_sub(tx_height) + 1) >= 10)
}
async fn prepare_send(
&self,
keys: FrostKeys<Ed25519>,