diff --git a/processor/src/coins/monero.rs b/processor/src/coins/monero.rs index 20582080..59adcbc8 100644 --- a/processor/src/coins/monero.rs +++ b/processor/src/coins/monero.rs @@ -13,7 +13,7 @@ use frost::{curve::Ed25519, ThresholdKeys}; use monero_serai::{ Protocol, transaction::Transaction, - block::Block as MBlock, + block::Block, rpc::{RpcError, HttpRpc, Rpc}, wallet::{ ViewPair, Scanner, @@ -134,20 +134,18 @@ pub struct SignableTransaction { actual: MSignableTransaction, } -#[derive(Clone, PartialEq, Eq, Debug)] -pub struct Block([u8; 32], MBlock); impl BlockTrait for Block { type Id = [u8; 32]; fn id(&self) -> Self::Id { - self.0 + self.hash() } fn parent(&self) -> Self::Id { - self.1.header.previous + self.header.previous } fn time(&self) -> u64 { - self.1.header.timestamp + self.header.timestamp } fn median_fee(&self) -> Fee { @@ -256,14 +254,18 @@ impl Coin for Monero { } async fn get_block(&self, number: usize) -> Result { - let hash = self.rpc.get_block_hash(number).await.map_err(|_| CoinError::ConnectionError)?; - let block = self.rpc.get_block(hash).await.map_err(|_| CoinError::ConnectionError)?; - Ok(Block(hash, block)) + Ok(Block( + self + .rpc + .get_block(self.rpc.get_block_hash(number).await.map_err(|_| CoinError::ConnectionError)?) + .await + .map_err(|_| CoinError::ConnectionError)?, + )) } async fn get_outputs( &self, - block: &Self::Block, + block: &Block, key: EdwardsPoint, ) -> Result, CoinError> { let mut txs = Self::scanner(key) @@ -305,7 +307,7 @@ impl Coin for Monero { async fn get_eventuality_completions( &self, eventualities: &mut EventualitiesTracker, - block: &Self::Block, + block: &Block, ) -> HashMap<[u8; 32], [u8; 32]> { let block = &block.1; @@ -317,7 +319,7 @@ impl Coin for Monero { async fn check_block( coin: &Monero, eventualities: &mut EventualitiesTracker, - block: &MBlock, + block: &Block, res: &mut HashMap<[u8; 32], [u8; 32]>, ) { for hash in &block.txs {