From 7d7e3d5472222d107c7ad39e77d0aee1c1e342c0 Mon Sep 17 00:00:00 2001 From: patrini32 Date: Fri, 28 Jun 2024 16:21:42 +0000 Subject: [PATCH 1/5] Fix lint --- ...sing_cancel_and_refund_command_timelock_not_expired.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/swap/tests/alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired.rs b/swap/tests/alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired.rs index a64377da..6b997fa1 100644 --- a/swap/tests/alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired.rs +++ b/swap/tests/alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired.rs @@ -43,7 +43,9 @@ async fn given_alice_and_bob_manually_cancel_when_timelock_not_expired_errors() .await .unwrap_err(); - assert!(error.to_string().contains("Cannot cancel swap because the cancel timelock has not expired yet")); + assert!(error + .to_string() + .contains("Cannot cancel swap because the cancel timelock has not expired yet")); ctx.restart_alice().await; @@ -71,7 +73,9 @@ async fn given_alice_and_bob_manually_cancel_when_timelock_not_expired_errors() let error = cli::refund(bob_swap.id, bob_swap.bitcoin_wallet, bob_swap.db) .await .unwrap_err(); - assert!(error.to_string().contains("Cannot refund swap because the cancel timelock has not expired yet")); + assert!(error + .to_string() + .contains("Cannot refund swap because the cancel timelock has not expired yet")); let (bob_swap, _) = ctx .stop_and_resume_bob_from_db(bob_join_handle, swap_id) From 2952d9812bd94c383fdfcbfcf57ef04450024ab8 Mon Sep 17 00:00:00 2001 From: patrini32 Date: Fri, 28 Jun 2024 16:42:36 +0000 Subject: [PATCH 2/5] Fix lint --- ...sing_cancel_and_refund_command_timelock_not_expired.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/swap/tests/alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired.rs b/swap/tests/alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired.rs index 6b997fa1..c4bd5470 100644 --- a/swap/tests/alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired.rs +++ b/swap/tests/alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired.rs @@ -44,8 +44,8 @@ async fn given_alice_and_bob_manually_cancel_when_timelock_not_expired_errors() .unwrap_err(); assert!(error - .to_string() - .contains("Cannot cancel swap because the cancel timelock has not expired yet")); + .to_string() + .contains("Cannot cancel swap because the cancel timelock has not expired yet")); ctx.restart_alice().await; @@ -74,8 +74,8 @@ async fn given_alice_and_bob_manually_cancel_when_timelock_not_expired_errors() .await .unwrap_err(); assert!(error - .to_string() - .contains("Cannot refund swap because the cancel timelock has not expired yet")); + .to_string() + .contains("Cannot refund swap because the cancel timelock has not expired yet")); let (bob_swap, _) = ctx .stop_and_resume_bob_from_db(bob_join_handle, swap_id) From 532831ee79553e844af054c6e86ab5f626b9a36b Mon Sep 17 00:00:00 2001 From: patrini32 Date: Fri, 28 Jun 2024 16:47:31 +0000 Subject: [PATCH 3/5] Fix lint --- ...efund_using_cancel_and_refund_command_timelock_not_expired.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/swap/tests/alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired.rs b/swap/tests/alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired.rs index c4bd5470..6584a3d2 100644 --- a/swap/tests/alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired.rs +++ b/swap/tests/alice_and_bob_refund_using_cancel_and_refund_command_timelock_not_expired.rs @@ -47,7 +47,6 @@ async fn given_alice_and_bob_manually_cancel_when_timelock_not_expired_errors() .to_string() .contains("Cannot cancel swap because the cancel timelock has not expired yet")); - ctx.restart_alice().await; let alice_swap = ctx.alice_next_swap().await; assert!(matches!( From 7f80851c4cac93cde3252c2462bfd70892518adb Mon Sep 17 00:00:00 2001 From: patrini32 Date: Fri, 28 Jun 2024 16:59:26 +0000 Subject: [PATCH 4/5] Fix test --- ...e_manually_punishes_after_bob_dead_and_bob_cancels.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/swap/tests/alice_manually_punishes_after_bob_dead_and_bob_cancels.rs b/swap/tests/alice_manually_punishes_after_bob_dead_and_bob_cancels.rs index 131f04f1..fe412f76 100644 --- a/swap/tests/alice_manually_punishes_after_bob_dead_and_bob_cancels.rs +++ b/swap/tests/alice_manually_punishes_after_bob_dead_and_bob_cancels.rs @@ -85,8 +85,13 @@ async fn alice_manually_punishes_after_bob_dead_and_bob_cancels() { .await; assert!(matches!(bob_swap.state, BobState::BtcCancelled { .. })); // Alice punished Bob, so he should be in the BtcPunished state. - let state = cli::refund(bob_swap_id, bob_swap.bitcoin_wallet, bob_swap.db).await?; - ctx.assert_bob_punished(state).await; + let error = cli::refund(bob_swap_id, bob_swap.bitcoin_wallet, bob_swap.db) + .await + .unwrap_err(); + assert_eq!( + &error, + "Cannot refund swap because we have already been punished" + ); Ok(()) }) .await; From eb7b16a3079dab31f84c625ebcfab8aa9877fef2 Mon Sep 17 00:00:00 2001 From: patrini32 Date: Fri, 28 Jun 2024 17:03:07 +0000 Subject: [PATCH 5/5] Fix error --- .../alice_manually_punishes_after_bob_dead_and_bob_cancels.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swap/tests/alice_manually_punishes_after_bob_dead_and_bob_cancels.rs b/swap/tests/alice_manually_punishes_after_bob_dead_and_bob_cancels.rs index fe412f76..374d6160 100644 --- a/swap/tests/alice_manually_punishes_after_bob_dead_and_bob_cancels.rs +++ b/swap/tests/alice_manually_punishes_after_bob_dead_and_bob_cancels.rs @@ -89,7 +89,7 @@ async fn alice_manually_punishes_after_bob_dead_and_bob_cancels() { .await .unwrap_err(); assert_eq!( - &error, + error.to_string(), "Cannot refund swap because we have already been punished" ); Ok(())