From 814a9a8d359ba379e846f6090356e89a14ae9b49 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Sat, 7 Jan 2023 03:21:06 -0500 Subject: [PATCH] Revert the previous commit's API change --- processor/src/coin/mod.rs | 2 +- processor/src/coin/monero.rs | 5 ++--- processor/src/wallet.rs | 15 +++++++++------ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/processor/src/coin/mod.rs b/processor/src/coin/mod.rs index 1bc609b2..6cb19509 100644 --- a/processor/src/coin/mod.rs +++ b/processor/src/coin/mod.rs @@ -69,7 +69,7 @@ pub trait Coin { &self, block: &Self::Block, key: ::G, - ) -> Result>, CoinError>; + ) -> Result, CoinError>; #[allow(clippy::too_many_arguments)] async fn prepare_send( diff --git a/processor/src/coin/monero.rs b/processor/src/coin/monero.rs index 78a6751a..ca44ad2b 100644 --- a/processor/src/coin/monero.rs +++ b/processor/src/coin/monero.rs @@ -169,7 +169,7 @@ impl Coin for Monero { &self, block: &Self::Block, key: dfg::EdwardsPoint, - ) -> Result>, CoinError> { + ) -> Result, CoinError> { let mut transactions = self .scanner(key) .scan(&self.rpc, block) @@ -190,12 +190,11 @@ impl Coin for Monero { }) .collect(); } - transactions = transactions.drain(..).filter(|outputs| !outputs.is_empty()).collect(); Ok( transactions .drain(..) - .map(|mut transaction| transaction.drain(..).map(Output::from).collect()) + .flat_map(|mut outputs| outputs.drain(..).map(Output::from).collect::>()) .collect(), ) } diff --git a/processor/src/wallet.rs b/processor/src/wallet.rs index f117e41c..340bccea 100644 --- a/processor/src/wallet.rs +++ b/processor/src/wallet.rs @@ -232,11 +232,6 @@ impl Wallet { self.coin.address(self.keys[self.keys.len() - 1].0.group_key()) } - // TODO: Remove - pub async fn is_confirmed(&mut self, tx: &[u8]) -> Result { - self.coin.is_confirmed(tx).await - } - pub async fn poll(&mut self) -> Result<(), CoinError> { if self.coin.get_latest_block_number().await? < (C::CONFIRMATIONS - 1) { return Ok(()); @@ -325,7 +320,15 @@ impl Wallet { let tx = self .coin - .prepare_send(keys.clone(), transcript, acknowledged_block, inputs, &outputs, fee) + .prepare_send( + keys.clone(), + transcript, + acknowledged_block, + inputs, + &outputs, + Some(keys.group_key()), + fee, + ) .await?; // self.db.save_tx(tx) // TODO txs.push(tx);