From 40dcf0355a9620224a58d9d791cb94cfe70b2001 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Fri, 26 Feb 2021 15:45:23 +1100 Subject: [PATCH] Simplify `Transfer::transfer` return type We never use the fee returned from this function, remove it. --- swap/src/monero.rs | 2 +- swap/src/monero/wallet.rs | 6 ++---- swap/src/protocol/alice/steps.rs | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/swap/src/monero.rs b/swap/src/monero.rs index 3e7f69ed..90224948 100644 --- a/swap/src/monero.rs +++ b/swap/src/monero.rs @@ -190,7 +190,7 @@ pub trait Transfer { public_spend_key: PublicKey, public_view_key: PublicViewKey, amount: Amount, - ) -> Result<(TransferProof, Amount)>; + ) -> Result; } #[async_trait] diff --git a/swap/src/monero/wallet.rs b/swap/src/monero/wallet.rs index a21ebe6b..b37eba55 100644 --- a/swap/src/monero/wallet.rs +++ b/swap/src/monero/wallet.rs @@ -82,7 +82,7 @@ impl Transfer for Wallet { public_spend_key: PublicKey, public_view_key: PublicViewKey, amount: Amount, - ) -> Result<(TransferProof, Amount)> { + ) -> Result { let destination_address = Address::standard(self.network, public_spend_key, public_view_key.into()); @@ -97,12 +97,10 @@ impl Transfer for Wallet { tracing::info!("Monero tx broadcasted!, tx hash: {:?}", tx_hash); let tx_key = PrivateKey::from_str(&res.tx_key)?; - let fee = Amount::from_piconero(res.fee); - let transfer_proof = TransferProof::new(tx_hash, tx_key); tracing::debug!(" Transfer proof: {:?}", transfer_proof); - Ok((transfer_proof, fee)) + Ok(transfer_proof) } } diff --git a/swap/src/protocol/alice/steps.rs b/swap/src/protocol/alice/steps.rs index b77479c2..9544c3f0 100644 --- a/swap/src/protocol/alice/steps.rs +++ b/swap/src/protocol/alice/steps.rs @@ -69,7 +69,7 @@ where let public_spend_key = S_a + state3.S_b_monero; let public_view_key = state3.v.public(); - let (transfer_proof, _) = monero_wallet + let transfer_proof = monero_wallet .transfer(public_spend_key, public_view_key, state3.xmr) .await?;