Implement a proper Monero Timelock type

Transaction scanning now returns the timelock to ensure it's 
acknowledged by wallets.

Fixes https://github.com/serai-dex/serai/issues/16.
This commit is contained in:
Luke Parker
2022-06-02 00:00:26 -04:00
parent 2ae715f899
commit dfd2f624ee
6 changed files with 62 additions and 23 deletions

View File

@@ -9,7 +9,7 @@ use frost::MultisigKeys;
use monero::util::address::Address;
use monero_serai::{
frost::Ed25519,
transaction::Transaction,
transaction::{Timelock, Transaction},
rpc::Rpc,
wallet::{SpendableOutput, SignableTransaction}
};
@@ -90,7 +90,18 @@ impl Coin for Monero {
}
async fn get_outputs(&self, block: &Self::Block, key: dfg::EdwardsPoint) -> Vec<Self::Output> {
block.iter().flat_map(|tx| tx.scan(self.view, key.0)).map(Output::from).collect()
block
.iter()
.flat_map(|tx| {
let (outputs, timelock) = tx.scan(self.view, key.0);
if timelock == Timelock::None {
outputs
} else {
vec![]
}
})
.map(Output::from)
.collect()
}
async fn prepare_send<R: RngCore + CryptoRng>(