mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-09-24 14:48:37 -04:00
Restart event loop in tests
Alice was attempting to create a new event loop using the same listen addr as the old one which was still running. This commit aborts the event loop before creating a new one.
This commit is contained in:
parent
77fc5743a2
commit
1597f5336b
11 changed files with 63 additions and 48 deletions
|
@ -8,8 +8,8 @@ use testutils::bob_run_until::is_btc_locked;
|
|||
#[tokio::test]
|
||||
async fn alice_punishes_if_bob_never_acts_after_fund() {
|
||||
testutils::setup_test(|mut ctx| async move {
|
||||
let alice_swap = ctx.new_swap_as_alice().await;
|
||||
let bob_swap = ctx.new_swap_as_bob().await;
|
||||
let (alice_swap, _) = ctx.new_swap_as_alice().await;
|
||||
let (bob_swap, bob_join_handle) = ctx.new_swap_as_bob().await;
|
||||
|
||||
let alice = alice::run(alice_swap);
|
||||
let alice_handle = tokio::spawn(alice);
|
||||
|
@ -23,7 +23,7 @@ async fn alice_punishes_if_bob_never_acts_after_fund() {
|
|||
|
||||
// Restart Bob after Alice punished to ensure Bob transitions to
|
||||
// punished and does not run indefinitely
|
||||
let bob_swap = ctx.recover_bob_from_db().await;
|
||||
let bob_swap = ctx.stop_and_resume_bob_from_db(bob_join_handle).await;
|
||||
assert!(matches!(bob_swap.state, BobState::BtcLocked {..}));
|
||||
|
||||
let bob_state = bob::run(bob_swap).await.unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue