mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-04-21 16:29:20 -04:00
Remove Arcs in favour of references
This commit is contained in:
parent
1fab6e396e
commit
e13c5446bf
@ -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);
|
||||
|
||||
|
@ -130,7 +130,7 @@ async fn run_until_internal(
|
||||
bob_peer_id,
|
||||
*state3.clone(),
|
||||
&mut event_loop_handle,
|
||||
monero_wallet.clone(),
|
||||
&monero_wallet,
|
||||
)
|
||||
.await?;
|
||||
|
||||
@ -286,7 +286,7 @@ async fn run_until_internal(
|
||||
state3.B,
|
||||
state3.cancel_timelock,
|
||||
state3.tx_cancel_sig_bob.clone(),
|
||||
bitcoin_wallet.clone(),
|
||||
&bitcoin_wallet,
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user