From 86290649e7d683baafaad013e97ca0e5e4db776b Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Thu, 4 Feb 2021 10:43:02 +1100 Subject: [PATCH] work in review comments --- swap/src/main.rs | 11 ++++++----- ...g_cancel_and_refund_command_timelock_not_exired.rs | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/swap/src/main.rs b/swap/src/main.rs index 71798092..a088ed5e 100644 --- a/swap/src/main.rs +++ b/swap/src/main.rs @@ -29,7 +29,7 @@ use protocol::{alice, bob, bob::Builder, SwapAmounts}; use std::{path::PathBuf, sync::Arc}; use structopt::StructOpt; use trace::init_tracing; -use tracing::info; +use tracing::{error, info, warn}; use uuid::Uuid; pub mod bitcoin; @@ -247,11 +247,12 @@ async fn main() -> Result<()> { Ok((txid, _)) => { info!("Cancel transaction successfully published with id {}", txid) } - Err(CancelError::CancelTimelockNotExpiredYet) => { - info!("The Cancel Transaction cannot be published yet, because the timelock has not expired. Please try again later.") - } + Err(CancelError::CancelTimelockNotExpiredYet) => error!( + "The Cancel Transaction cannot be published yet, \ + because the timelock has not expired. Please try again later." + ), Err(CancelError::CancelTxAlreadyPublished) => { - info!("The Cancel Transaction has already been published.") + warn!("The Cancel Transaction has already been published.") } } } diff --git a/swap/tests/bob_refunds_using_cancel_and_refund_command_timelock_not_exired.rs b/swap/tests/bob_refunds_using_cancel_and_refund_command_timelock_not_exired.rs index a1c3da82..07b69590 100644 --- a/swap/tests/bob_refunds_using_cancel_and_refund_command_timelock_not_exired.rs +++ b/swap/tests/bob_refunds_using_cancel_and_refund_command_timelock_not_exired.rs @@ -19,7 +19,7 @@ async fn given_bob_manually_cancels_when_timelock_not_expired_errors() { let (bob_swap, bob_join_handle) = ctx.stop_and_resume_bob_from_db(bob_join_handle).await; assert!(matches!(bob_swap.state, BobState::BtcLocked { .. })); - // Bob manually cancels + // Bob tries but fails to manually cancel let result = bob::cancel( bob_swap.swap_id, bob_swap.state, @@ -37,7 +37,7 @@ async fn given_bob_manually_cancels_when_timelock_not_expired_errors() { let (bob_swap, bob_join_handle) = ctx.stop_and_resume_bob_from_db(bob_join_handle).await; assert!(matches!(bob_swap.state, BobState::BtcLocked { .. })); - // Bob manually refunds + // Bob tries but fails to manually refund bob::refund( bob_swap.swap_id, bob_swap.state,