Remove async block when it is not needed

This commit is contained in:
Franck Royer 2020-12-21 14:53:35 +11:00
parent e079b84500
commit 297b15e3ce
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
4 changed files with 14 additions and 17 deletions

View File

@ -320,6 +320,6 @@ async fn bob_swap(
swap_id, swap_id,
); );
tokio::spawn(async move { event_loop.run().await }); tokio::spawn(event_loop.run());
swap.await swap.await
} }

View File

@ -119,7 +119,7 @@ async fn given_alice_restarts_after_encsig_is_learned_resume_swap() {
let (mut event_loop_after_restart, event_loop_handle_after_restart) = let (mut event_loop_after_restart, event_loop_handle_after_restart) =
testutils::init_alice_event_loop(alice_multiaddr); testutils::init_alice_event_loop(alice_multiaddr);
let _alice_swarm_fut = tokio::spawn(async move { event_loop_after_restart.run().await }); tokio::spawn(async move { event_loop_after_restart.run().await });
let db_swap = alice_db.get_state(alice_swap_id).unwrap(); let db_swap = alice_db.get_state(alice_swap_id).unwrap();
let resume_state = AliceState::try_from(db_swap).unwrap(); let resume_state = AliceState::try_from(db_swap).unwrap();

View File

@ -80,22 +80,19 @@ async fn given_bob_restarts_after_encsig_is_sent_resume_swap() {
let bob_btc_wallet_clone = bob_btc_wallet.clone(); let bob_btc_wallet_clone = bob_btc_wallet.clone();
let bob_xmr_wallet_clone = bob_xmr_wallet.clone(); let bob_xmr_wallet_clone = bob_xmr_wallet.clone();
let alice_swap_handle = tokio::spawn(async move { let alice_swap_handle = tokio::spawn(alice::swap::swap(
alice::swap::swap( alice_state,
alice_state, alice_event_loop_handle,
alice_event_loop_handle, alice_btc_wallet.clone(),
alice_btc_wallet.clone(), alice_xmr_wallet.clone(),
alice_xmr_wallet.clone(), config,
config, Uuid::new_v4(),
Uuid::new_v4(), alice_db,
alice_db, ));
)
.await
});
tokio::spawn(async move { alice_event_loop.run().await }); tokio::spawn(async move { alice_event_loop.run().await });
tokio::spawn(async move { bob_event_loop.run().await }); tokio::spawn(bob_event_loop.run());
let bob_swap_id = Uuid::new_v4(); let bob_swap_id = Uuid::new_v4();
let bob_db_datadir = tempdir().unwrap(); let bob_db_datadir = tempdir().unwrap();
@ -125,7 +122,7 @@ async fn given_bob_restarts_after_encsig_is_sent_resume_swap() {
let (event_loop_after_restart, event_loop_handle_after_restart) = let (event_loop_after_restart, event_loop_handle_after_restart) =
testutils::init_bob_event_loop(alice_peer_id, alice_multiaddr); testutils::init_bob_event_loop(alice_peer_id, alice_multiaddr);
let _bob_swarm_fut = tokio::spawn(async move { event_loop_after_restart.run().await }); tokio::spawn(event_loop_after_restart.run());
let db_swap = bob_db.get_state(bob_swap_id).unwrap(); let db_swap = bob_db.get_state(bob_swap_id).unwrap();
let resume_state = BobState::try_from(db_swap).unwrap(); let resume_state = BobState::try_from(db_swap).unwrap();

View File

@ -100,7 +100,7 @@ async fn given_alice_restarts_after_xmr_is_locked_abort_swap() {
) )
}; };
tokio::spawn(async move { bob_event_loop.run().await }); tokio::spawn(bob_event_loop.run());
// We are selecting with alice_event_loop_1 so that we stop polling on it once // We are selecting with alice_event_loop_1 so that we stop polling on it once
// the try_join is finished. // the try_join is finished.