Timeout for Alice waiting for ack for sending transfer proof

If dialing Bob fails Alice waits for the acknowledgement of the transfer proof indefinitely.
The timout prevents her execution from hanging.
Added a ToDo to re-visit the ack receivers. They don't add value at the moment and should be removed.
This commit is contained in:
Daniel Karzel 2021-02-01 18:14:53 +11:00
parent c9adbde5d5
commit 2d5d70d856
4 changed files with 36 additions and 14 deletions

View file

@ -10,7 +10,7 @@ async fn given_bob_manually_refunds_after_btc_locked_bob_refunds() {
let (bob_swap, bob_join_handle) = ctx.new_swap_as_bob().await;
let alice_handle = alice::run(alice_swap);
tokio::spawn(alice_handle);
let alice_swap_handle = tokio::spawn(alice_handle);
let bob_state = bob::run_until(bob_swap, is_btc_locked).await.unwrap();
@ -57,10 +57,8 @@ async fn given_bob_manually_refunds_after_btc_locked_bob_refunds() {
ctx.assert_bob_refunded(bob_state).await;
// TODO: Alice hangs indefinitely waiting for Blob's acknowledge on
// sending the transfer proof
// let alice_state = alice_swap_handle.await.unwrap().unwrap();
// ctx.assert_alice_refunded(alice_state).await;
let alice_state = alice_swap_handle.await.unwrap().unwrap();
ctx.assert_alice_refunded(alice_state).await;
})
.await;
}