mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-24 15:09:35 -05:00
Ensure we wait for other party to complete
Before we check the balances.
This commit is contained in:
parent
1fa812b727
commit
e079b84500
@ -90,7 +90,7 @@ async fn given_alice_restarts_after_encsig_is_learned_resume_swap() {
|
||||
let alice_db = Database::open(alice_db_datadir.path()).unwrap();
|
||||
|
||||
tokio::spawn(async move { alice_event_loop.run().await });
|
||||
tokio::spawn(bob_fut);
|
||||
let bob_swap_handle = tokio::spawn(bob_fut);
|
||||
tokio::spawn(bob_event_loop.run());
|
||||
|
||||
let alice_swap_id = Uuid::new_v4();
|
||||
@ -136,6 +136,9 @@ async fn given_alice_restarts_after_encsig_is_learned_resume_swap() {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// Wait for Bob to finish
|
||||
bob_swap_handle.await.unwrap().unwrap();
|
||||
|
||||
assert!(matches!(alice_state, AliceState::BtcRedeemed {..}));
|
||||
|
||||
let btc_alice_final = alice_btc_wallet.as_ref().balance().await.unwrap();
|
||||
|
@ -80,7 +80,7 @@ async fn given_bob_restarts_after_encsig_is_sent_resume_swap() {
|
||||
let bob_btc_wallet_clone = bob_btc_wallet.clone();
|
||||
let bob_xmr_wallet_clone = bob_xmr_wallet.clone();
|
||||
|
||||
let _ = tokio::spawn(async move {
|
||||
let alice_swap_handle = tokio::spawn(async move {
|
||||
alice::swap::swap(
|
||||
alice_state,
|
||||
alice_event_loop_handle,
|
||||
@ -93,9 +93,9 @@ async fn given_bob_restarts_after_encsig_is_sent_resume_swap() {
|
||||
.await
|
||||
});
|
||||
|
||||
let _alice_swarm_fut = tokio::spawn(async move { alice_event_loop.run().await });
|
||||
tokio::spawn(async move { alice_event_loop.run().await });
|
||||
|
||||
let _bob_swarm_fut = tokio::spawn(async move { bob_event_loop.run().await });
|
||||
tokio::spawn(async move { bob_event_loop.run().await });
|
||||
|
||||
let bob_swap_id = Uuid::new_v4();
|
||||
let bob_db_datadir = tempdir().unwrap();
|
||||
@ -142,6 +142,9 @@ async fn given_bob_restarts_after_encsig_is_sent_resume_swap() {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// Wait for Alice to finish too
|
||||
alice_swap_handle.await.unwrap().unwrap();
|
||||
|
||||
assert!(matches!(bob_state, BobState::XmrRedeemed {..}));
|
||||
|
||||
let btc_alice_final = alice_btc_wallet_clone.as_ref().balance().await.unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user