Revert the previous commit's API change

This commit is contained in:
Luke Parker 2023-01-07 03:21:06 -05:00
parent 9662e9e1af
commit 814a9a8d35
No known key found for this signature in database
3 changed files with 12 additions and 10 deletions

View file

@ -69,7 +69,7 @@ pub trait Coin {
&self, &self,
block: &Self::Block, block: &Self::Block,
key: <Self::Curve as Ciphersuite>::G, key: <Self::Curve as Ciphersuite>::G,
) -> Result<Vec<Vec<Self::Output>>, CoinError>; ) -> Result<Vec<Self::Output>, CoinError>;
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
async fn prepare_send( async fn prepare_send(

View file

@ -169,7 +169,7 @@ impl Coin for Monero {
&self, &self,
block: &Self::Block, block: &Self::Block,
key: dfg::EdwardsPoint, key: dfg::EdwardsPoint,
) -> Result<Vec<Vec<Self::Output>>, CoinError> { ) -> Result<Vec<Self::Output>, CoinError> {
let mut transactions = self let mut transactions = self
.scanner(key) .scanner(key)
.scan(&self.rpc, block) .scan(&self.rpc, block)
@ -190,12 +190,11 @@ impl Coin for Monero {
}) })
.collect(); .collect();
} }
transactions = transactions.drain(..).filter(|outputs| !outputs.is_empty()).collect();
Ok( Ok(
transactions transactions
.drain(..) .drain(..)
.map(|mut transaction| transaction.drain(..).map(Output::from).collect()) .flat_map(|mut outputs| outputs.drain(..).map(Output::from).collect::<Vec<_>>())
.collect(), .collect(),
) )
} }

View file

@ -232,11 +232,6 @@ impl<D: CoinDb, C: Coin> Wallet<D, C> {
self.coin.address(self.keys[self.keys.len() - 1].0.group_key()) self.coin.address(self.keys[self.keys.len() - 1].0.group_key())
} }
// TODO: Remove
pub async fn is_confirmed(&mut self, tx: &[u8]) -> Result<bool, CoinError> {
self.coin.is_confirmed(tx).await
}
pub async fn poll(&mut self) -> Result<(), CoinError> { pub async fn poll(&mut self) -> Result<(), CoinError> {
if self.coin.get_latest_block_number().await? < (C::CONFIRMATIONS - 1) { if self.coin.get_latest_block_number().await? < (C::CONFIRMATIONS - 1) {
return Ok(()); return Ok(());
@ -325,7 +320,15 @@ impl<D: CoinDb, C: Coin> Wallet<D, C> {
let tx = self let tx = self
.coin .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?; .await?;
// self.db.save_tx(tx) // TODO // self.db.save_tx(tx) // TODO
txs.push(tx); txs.push(tx);