diff --git a/swap/src/main.rs b/swap/src/main.rs index 676be61d..770b95f5 100644 --- a/swap/src/main.rs +++ b/swap/src/main.rs @@ -86,8 +86,8 @@ async fn main() -> Result<()> { seed, config, swap_id, - bitcoin_wallet, - monero_wallet, + Arc::new(bitcoin_wallet), + Arc::new(monero_wallet), db_path, listen_addr, ) @@ -131,8 +131,8 @@ async fn main() -> Result<()> { seed, db_path, swap_id, - bitcoin_wallet, - monero_wallet, + Arc::new(bitcoin_wallet), + Arc::new(monero_wallet), alice_addr, alice_peer_id, ); @@ -177,8 +177,8 @@ async fn main() -> Result<()> { seed, config, swap_id, - bitcoin_wallet, - monero_wallet, + Arc::new(bitcoin_wallet), + Arc::new(monero_wallet), db_path, listen_addr, ) @@ -208,8 +208,8 @@ async fn main() -> Result<()> { seed, db_path, swap_id, - bitcoin_wallet, - monero_wallet, + Arc::new(bitcoin_wallet), + Arc::new(monero_wallet), alice_addr, alice_peer_id, ); @@ -228,7 +228,7 @@ async fn setup_wallets( bitcoin_wallet_name: &str, monero_wallet_rpc_url: url::Url, config: Config, -) -> Result<(Arc, Arc)> { +) -> Result<(swap::bitcoin::Wallet, swap::monero::Wallet)> { let bitcoin_wallet = swap::bitcoin::Wallet::new(bitcoin_wallet_name, bitcoind_url, config.bitcoin_network) .await?; @@ -237,7 +237,6 @@ async fn setup_wallets( "Connection to Bitcoin wallet succeeded, balance: {}", bitcoin_balance ); - let bitcoin_wallet = Arc::new(bitcoin_wallet); let monero_wallet = monero::Wallet::new(monero_wallet_rpc_url, config.monero_network); let monero_balance = monero_wallet.get_balance().await?; @@ -245,7 +244,6 @@ async fn setup_wallets( "Connection to Monero wallet succeeded, balance: {}", monero_balance ); - let monero_wallet = Arc::new(monero_wallet); Ok((bitcoin_wallet, monero_wallet)) } diff --git a/swap/src/protocol/alice.rs b/swap/src/protocol/alice.rs index c08e3cdc..dba570d8 100644 --- a/swap/src/protocol/alice.rs +++ b/swap/src/protocol/alice.rs @@ -118,8 +118,8 @@ impl Builder { Ok(( Swap { event_loop_handle, - bitcoin_wallet: self.bitcoin_wallet.clone(), - monero_wallet: self.monero_wallet.clone(), + bitcoin_wallet: self.bitcoin_wallet, + monero_wallet: self.monero_wallet, config: self.config, db, state: initial_state, @@ -148,8 +148,8 @@ impl Builder { Swap { state: resume_state, event_loop_handle, - bitcoin_wallet: self.bitcoin_wallet.clone(), - monero_wallet: self.monero_wallet.clone(), + bitcoin_wallet: self.bitcoin_wallet, + monero_wallet: self.monero_wallet, config: self.config, swap_id: self.swap_id, db, @@ -183,7 +183,7 @@ impl Builder { let a = bitcoin::SecretKey::new_random(rng); let s_a = cross_curve_dleq::Scalar::random(rng); let v_a = monero::PrivateViewKey::new_random(rng); - let redeem_address = self.bitcoin_wallet.as_ref().new_address().await?; + let redeem_address = self.bitcoin_wallet.new_address().await?; let punish_address = redeem_address.clone(); let state0 = State0::new( a,