Remove Arcs in favour of references

pull/261/head
Daniel Karzel 3 years ago
parent 0b4c0758bb
commit 2e3c2d8edf

@ -147,7 +147,7 @@ impl Client {
Ok(()) Ok(())
} }
/// Opens a wallet using `filename`. /// Close the currently opened wallet, after trying to save it.
pub async fn close_wallet(&self) -> Result<()> { pub async fn close_wallet(&self) -> Result<()> {
let request = Request::new("close_wallet", ""); let request = Request::new("close_wallet", "");

@ -22,7 +22,6 @@ use futures::{
}; };
use libp2p::PeerId; use libp2p::PeerId;
use sha2::Sha256; use sha2::Sha256;
use std::sync::Arc;
use tokio::time::timeout; use tokio::time::timeout;
// TODO(Franck): Use helper functions from xmr-btc instead of re-writing them // TODO(Franck): Use helper functions from xmr-btc instead of re-writing them
@ -52,7 +51,7 @@ pub async fn lock_xmr(
bob_peer_id: PeerId, bob_peer_id: PeerId,
state3: alice::State3, state3: alice::State3,
event_loop_handle: &mut EventLoopHandle, event_loop_handle: &mut EventLoopHandle,
monero_wallet: Arc<monero::Wallet>, monero_wallet: &monero::Wallet,
) -> Result<()> { ) -> Result<()> {
let S_a = monero::PublicKey::from_private_key(&monero::PrivateKey { scalar: state3.s_a }); let S_a = monero::PublicKey::from_private_key(&monero::PrivateKey { scalar: state3.s_a });
@ -126,14 +125,13 @@ pub async fn publish_cancel_transaction(
B: bitcoin::PublicKey, B: bitcoin::PublicKey,
cancel_timelock: CancelTimelock, cancel_timelock: CancelTimelock,
tx_cancel_sig_bob: bitcoin::Signature, tx_cancel_sig_bob: bitcoin::Signature,
bitcoin_wallet: Arc<bitcoin::Wallet>, bitcoin_wallet: &bitcoin::Wallet,
) -> Result<bitcoin::TxCancel> { ) -> Result<bitcoin::TxCancel> {
// First wait for cancel timelock to expire // First wait for cancel timelock to expire
let tx_lock_height = bitcoin_wallet let tx_lock_height = bitcoin_wallet
.transaction_block_height(tx_lock.txid()) .transaction_block_height(tx_lock.txid())
.await?; .await?;
poll_until_block_height_is_gte(bitcoin_wallet.as_ref(), tx_lock_height + cancel_timelock) poll_until_block_height_is_gte(&bitcoin_wallet, tx_lock_height + cancel_timelock).await?;
.await?;
let tx_cancel = bitcoin::TxCancel::new(&tx_lock, cancel_timelock, a.public(), B); let tx_cancel = bitcoin::TxCancel::new(&tx_lock, cancel_timelock, a.public(), B);

@ -130,7 +130,7 @@ async fn run_until_internal(
bob_peer_id, bob_peer_id,
*state3.clone(), *state3.clone(),
&mut event_loop_handle, &mut event_loop_handle,
monero_wallet.clone(), &monero_wallet,
) )
.await?; .await?;
@ -286,7 +286,7 @@ async fn run_until_internal(
state3.B, state3.B,
state3.cancel_timelock, state3.cancel_timelock,
state3.tx_cancel_sig_bob.clone(), state3.tx_cancel_sig_bob.clone(),
bitcoin_wallet.clone(), &bitcoin_wallet,
) )
.await?; .await?;

Loading…
Cancel
Save