Remove Arcs in favour of references

This commit is contained in:
Daniel Karzel 2021-03-03 16:42:05 +11:00
parent 0b4c0758bb
commit 2e3c2d8edf
3 changed files with 6 additions and 8 deletions

View file

@ -22,7 +22,6 @@ use futures::{
};
use libp2p::PeerId;
use sha2::Sha256;
use std::sync::Arc;
use tokio::time::timeout;
// 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,
state3: alice::State3,
event_loop_handle: &mut EventLoopHandle,
monero_wallet: Arc<monero::Wallet>,
monero_wallet: &monero::Wallet,
) -> Result<()> {
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,
cancel_timelock: CancelTimelock,
tx_cancel_sig_bob: bitcoin::Signature,
bitcoin_wallet: Arc<bitcoin::Wallet>,
bitcoin_wallet: &bitcoin::Wallet,
) -> Result<bitcoin::TxCancel> {
// First wait for cancel timelock to expire
let tx_lock_height = bitcoin_wallet
.transaction_block_height(tx_lock.txid())
.await?;
poll_until_block_height_is_gte(bitcoin_wallet.as_ref(), tx_lock_height + cancel_timelock)
.await?;
poll_until_block_height_is_gte(&bitcoin_wallet, tx_lock_height + cancel_timelock).await?;
let tx_cancel = bitcoin::TxCancel::new(&tx_lock, cancel_timelock, a.public(), B);