@ -1,6 +1,6 @@
use bitcoin_harness ::Bitcoind ;
use bitcoin_harness ::Bitcoind ;
use futures ::future ::try_join ;
use futures ::future ::try_join ;
use libp2p ::{ Multiaddr , PeerId } ;
use libp2p ::Multiaddr ;
use monero_harness ::Monero ;
use monero_harness ::Monero ;
use rand ::rngs ::OsRng ;
use rand ::rngs ::OsRng ;
use std ::sync ::Arc ;
use std ::sync ::Arc ;
@ -52,7 +52,6 @@ async fn happy_path() {
alice_swarm_handle ,
alice_swarm_handle ,
alice_btc_wallet ,
alice_btc_wallet ,
alice_xmr_wallet ,
alice_xmr_wallet ,
alice_peer_id ,
) = init_alice (
) = init_alice (
& bitcoind ,
& bitcoind ,
& monero ,
& monero ,
@ -68,7 +67,6 @@ async fn happy_path() {
let ( bob_state , bob_swarm_driver , bob_swarm_handle , bob_btc_wallet , bob_xmr_wallet , bob_db ) =
let ( bob_state , bob_swarm_driver , bob_swarm_handle , bob_btc_wallet , bob_xmr_wallet , bob_db ) =
init_bob (
init_bob (
alice_multiaddr ,
alice_multiaddr ,
alice_peer_id ,
& bitcoind ,
& bitcoind ,
& monero ,
& monero ,
btc_to_swap ,
btc_to_swap ,
@ -151,29 +149,22 @@ async fn alice_punishes_if_bob_never_acts_after_fund() {
let config = Config ::regtest ( ) ;
let config = Config ::regtest ( ) ;
let (
let ( alice_state , mut alice_swarm , alice_swarm_handle , alice_btc_wallet , alice_xmr_wallet ) =
alice_state ,
init_alice (
mut alice_swarm ,
& bitcoind ,
alice_swarm_handle ,
& monero ,
alice_btc_wallet ,
btc_to_swap ,
alice_xmr_wallet ,
alice_btc_starting_balance ,
alice_peer_id ,
xmr_to_swap ,
) = init_alice (
alice_xmr_starting_balance ,
& bitcoind ,
alice_multiaddr . clone ( ) ,
& monero ,
config ,
btc_to_swap ,
)
alice_btc_starting_balance ,
. await ;
xmr_to_swap ,
alice_xmr_starting_balance ,
alice_multiaddr . clone ( ) ,
config ,
)
. await ;
let ( bob_state , bob_swarm_driver , bob_swarm_handle , bob_btc_wallet , bob_xmr_wallet , bob_db ) =
let ( bob_state , bob_swarm_driver , bob_swarm_handle , bob_btc_wallet , bob_xmr_wallet , bob_db ) =
init_bob (
init_bob (
alice_multiaddr ,
alice_multiaddr ,
alice_peer_id ,
& bitcoind ,
& bitcoind ,
& monero ,
& monero ,
btc_to_swap ,
btc_to_swap ,
@ -276,7 +267,6 @@ async fn both_refund() {
alice_swarm_handle ,
alice_swarm_handle ,
alice_btc_wallet ,
alice_btc_wallet ,
alice_xmr_wallet ,
alice_xmr_wallet ,
alice_peer_id ,
) = init_alice (
) = init_alice (
& bitcoind ,
& bitcoind ,
& monero ,
& monero ,
@ -292,7 +282,6 @@ async fn both_refund() {
let ( bob_state , bob_swarm_driver , bob_swarm_handle , bob_btc_wallet , bob_xmr_wallet , bob_db ) =
let ( bob_state , bob_swarm_driver , bob_swarm_handle , bob_btc_wallet , bob_xmr_wallet , bob_db ) =
init_bob (
init_bob (
alice_multiaddr ,
alice_multiaddr ,
alice_peer_id ,
& bitcoind ,
& bitcoind ,
& monero ,
& monero ,
btc_to_swap ,
btc_to_swap ,
@ -398,7 +387,6 @@ async fn init_alice(
alice ::event_loop ::EventLoopHandle ,
alice ::event_loop ::EventLoopHandle ,
Arc < swap ::bitcoin ::Wallet > ,
Arc < swap ::bitcoin ::Wallet > ,
Arc < swap ::monero ::Wallet > ,
Arc < swap ::monero ::Wallet > ,
PeerId ,
) {
) {
monero
monero
. init ( vec! [ ( "alice" , xmr_starting_balance . as_piconero ( ) ) ] )
. init ( vec! [ ( "alice" , xmr_starting_balance . as_piconero ( ) ) ] )
@ -448,7 +436,6 @@ async fn init_alice(
)
)
} ;
} ;
let alice_peer_id = alice_behaviour . peer_id ( ) ;
let alice_transport = build ( alice_behaviour . identity ( ) ) . unwrap ( ) ;
let alice_transport = build ( alice_behaviour . identity ( ) ) . unwrap ( ) ;
let ( swarm_driver , handle ) =
let ( swarm_driver , handle ) =
@ -460,14 +447,12 @@ async fn init_alice(
handle ,
handle ,
alice_btc_wallet ,
alice_btc_wallet ,
alice_xmr_wallet ,
alice_xmr_wallet ,
alice_peer_id ,
)
)
}
}
#[ allow(clippy::too_many_arguments) ]
#[ allow(clippy::too_many_arguments) ]
async fn init_bob (
async fn init_bob (
alice_multiaddr : Multiaddr ,
alice_multiaddr : Multiaddr ,
alice_peer_id : PeerId ,
bitcoind : & Bitcoind < ' _ > ,
bitcoind : & Bitcoind < ' _ > ,
monero : & Monero ,
monero : & Monero ,
btc_to_swap : bitcoin ::Amount ,
btc_to_swap : bitcoin ::Amount ,
@ -525,7 +510,6 @@ async fn init_bob(
let bob_state = BobState ::Started {
let bob_state = BobState ::Started {
state0 ,
state0 ,
amounts ,
amounts ,
peer_id : alice_peer_id ,
addr : alice_multiaddr ,
addr : alice_multiaddr ,
} ;
} ;