refactor and print successful refund message only if it succeeded

This commit is contained in:
patrini32 2024-06-05 15:46:48 +03:00 committed by patrini32
parent 1c6e757f02
commit 8b9f1b04c9
2 changed files with 4 additions and 3 deletions

View File

@ -19,8 +19,9 @@ pub async fn cancel_and_refund(
Ok(s) => s,
Err(e) => bail!(e),
};
tracing::info!("Refund transaction submitted");
if matches!(state, BobState::BtcRefunded { .. }) {
tracing::info!("Refund transaction submitted");
}
Ok(state)
}

View File

@ -73,7 +73,7 @@ async fn alice_manually_punishes_after_bob_dead_and_bob_cancels() {
let (bob_swap, _) = ctx
.stop_and_resume_bob_from_db(bob_join_handle, bob_swap_id)
.await;
assert!(matches!(bob_swap.state, BobState::BtcLocked { .. }));
let state =
cli::cancel_and_refund(bob_swap_id, bob_swap.bitcoin_wallet, bob_swap.db).await?;
ctx.assert_bob_punished(state).await;