mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Scope futures' instanciation
This commit is contained in:
parent
6226e5789f
commit
1c7cc7ee46
@ -21,7 +21,7 @@ fn setup_tracing() {
|
|||||||
.set_default();
|
.set_default();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is just to keep the container alive
|
// This is just to keep the containers alive
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
struct Containers<'a> {
|
struct Containers<'a> {
|
||||||
bitcoind: Bitcoind<'a>,
|
bitcoind: Bitcoind<'a>,
|
||||||
@ -116,10 +116,11 @@ async fn alice_safe_restart_after_btc_is_locked() {
|
|||||||
xmr: xmr_to_swap,
|
xmr: xmr_to_swap,
|
||||||
};
|
};
|
||||||
|
|
||||||
let alice_behaviour = alice::Behaviour::default();
|
let (alice_swap, alice_peer_id) = {
|
||||||
let alice_peer_id = alice_behaviour.peer_id().clone();
|
|
||||||
let alice_transport = build(alice_behaviour.identity()).unwrap();
|
|
||||||
let rng = &mut OsRng;
|
let rng = &mut OsRng;
|
||||||
|
let alice_behaviour = alice::Behaviour::default();
|
||||||
|
let alice_peer_id = alice_behaviour.peer_id();
|
||||||
|
let alice_transport = build(alice_behaviour.identity()).unwrap();
|
||||||
let alice_state = {
|
let alice_state = {
|
||||||
let a = bitcoin::SecretKey::new_random(rng);
|
let a = bitcoin::SecretKey::new_random(rng);
|
||||||
let s_a = cross_curve_dleq::Scalar::random(rng);
|
let s_a = cross_curve_dleq::Scalar::random(rng);
|
||||||
@ -137,7 +138,9 @@ async fn alice_safe_restart_after_btc_is_locked() {
|
|||||||
let swap_id = Uuid::new_v4();
|
let swap_id = Uuid::new_v4();
|
||||||
let tmp_dir = TempDir::new().unwrap();
|
let tmp_dir = TempDir::new().unwrap();
|
||||||
let db = Database::open(tmp_dir.path()).unwrap();
|
let db = Database::open(tmp_dir.path()).unwrap();
|
||||||
let alice_swap = alice::swap::swap(
|
|
||||||
|
(
|
||||||
|
alice::swap::swap(
|
||||||
alice_state,
|
alice_state,
|
||||||
alice_swarm,
|
alice_swarm,
|
||||||
alice_btc_wallet.clone(),
|
alice_btc_wallet.clone(),
|
||||||
@ -145,8 +148,13 @@ async fn alice_safe_restart_after_btc_is_locked() {
|
|||||||
config,
|
config,
|
||||||
swap_id,
|
swap_id,
|
||||||
db,
|
db,
|
||||||
);
|
),
|
||||||
|
alice_peer_id,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
let bob_swap = {
|
||||||
|
let rng = &mut OsRng;
|
||||||
let bob_db_dir = tempdir().unwrap();
|
let bob_db_dir = tempdir().unwrap();
|
||||||
let bob_db = Database::open(bob_db_dir.path()).unwrap();
|
let bob_db = Database::open(bob_db_dir.path()).unwrap();
|
||||||
let bob_behaviour = bob::Behaviour::default();
|
let bob_behaviour = bob::Behaviour::default();
|
||||||
@ -168,7 +176,7 @@ async fn alice_safe_restart_after_btc_is_locked() {
|
|||||||
addr: alice_multiaddr,
|
addr: alice_multiaddr,
|
||||||
};
|
};
|
||||||
let bob_swarm = bob::new_swarm(bob_transport, bob_behaviour).unwrap();
|
let bob_swarm = bob::new_swarm(bob_transport, bob_behaviour).unwrap();
|
||||||
let bob_swap = bob::swap::swap(
|
bob::swap::swap(
|
||||||
bob_state,
|
bob_state,
|
||||||
bob_swarm,
|
bob_swarm,
|
||||||
bob_db,
|
bob_db,
|
||||||
@ -176,7 +184,8 @@ async fn alice_safe_restart_after_btc_is_locked() {
|
|||||||
bob_xmr_wallet.clone(),
|
bob_xmr_wallet.clone(),
|
||||||
OsRng,
|
OsRng,
|
||||||
Uuid::new_v4(),
|
Uuid::new_v4(),
|
||||||
);
|
)
|
||||||
|
};
|
||||||
|
|
||||||
try_join(alice_swap, bob_swap).await.unwrap();
|
try_join(alice_swap, bob_swap).await.unwrap();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user