diff --git a/swap/src/bin/swap_cli.rs b/swap/src/bin/swap_cli.rs index f266460a..1dcd6959 100644 --- a/swap/src/bin/swap_cli.rs +++ b/swap/src/bin/swap_cli.rs @@ -35,7 +35,7 @@ use swap::{ }, seed::Seed, }; -use tracing::{debug, error, info, warn, Level}; +use tracing::{debug, error, warn, Level}; use tracing_subscriber::FmtSubscriber; use uuid::Uuid; @@ -63,8 +63,8 @@ async fn main() -> Result<()> { None => Config::testnet(), }; - info!( - "Database and Seed will be stored in directory: {}", + debug!( + "Database and seed will be stored in {}", config.data.dir.display() ); @@ -240,7 +240,7 @@ async fn main() -> Result<()> { cancel_result = cancel => { match cancel_result? { Ok((txid, _)) => { - info!("Cancel transaction successfully published with id {}", txid) + debug!("Cancel transaction successfully published with id {}", txid) } Err(CancelError::CancelTimelockNotExpiredYet) => error!( "The Cancel Transaction cannot be published yet, \ @@ -353,7 +353,7 @@ async fn init_wallets( monero_wallet_rpc_url ))?; - info!( + debug!( "Created Monero wallet for blockchain monitoring with name {}", MONERO_BLOCKCHAIN_MONITORING_WALLET_NAME ); diff --git a/swap/src/cli/config.rs b/swap/src/cli/config.rs index 2efa1b35..ce963a25 100644 --- a/swap/src/cli/config.rs +++ b/swap/src/cli/config.rs @@ -6,7 +6,7 @@ use std::{ ffi::OsStr, path::{Path, PathBuf}, }; -use tracing::info; +use tracing::debug; use url::Url; pub const DEFAULT_ELECTRUM_HTTP_URL: &str = "https://blockstream.info/testnet/api/"; @@ -66,7 +66,7 @@ pub struct ConfigNotInitialized {} pub fn read_config(config_path: PathBuf) -> Result> { if config_path.exists() { - info!( + debug!( "Using config file at default path: {}", config_path.display() ); diff --git a/swap/src/monero/wallet.rs b/swap/src/monero/wallet.rs index 89e9be5d..b79ced60 100644 --- a/swap/src/monero/wallet.rs +++ b/swap/src/monero/wallet.rs @@ -89,14 +89,17 @@ impl Transfer for Wallet { .transfer(0, amount.as_piconero(), &destination_address.to_string()) .await?; - let tx_hash = TxHash(res.tx_hash); - tracing::info!("Monero tx broadcasted!, tx hash: {:?}", tx_hash); - let tx_key = PrivateKey::from_str(&res.tx_key)?; + tracing::debug!( + "sent transfer of {} to {} in {}", + amount, + public_spend_key, + res.tx_hash + ); - let transfer_proof = TransferProof::new(tx_hash, tx_key); - tracing::debug!(" Transfer proof: {:?}", transfer_proof); - - Ok(transfer_proof) + Ok(TransferProof::new( + TxHash(res.tx_hash), + PrivateKey::from_str(&res.tx_key)?, + )) } } diff --git a/swap/src/protocol/bob/event_loop.rs b/swap/src/protocol/bob/event_loop.rs index a5126fc4..8dcf3e89 100644 --- a/swap/src/protocol/bob/event_loop.rs +++ b/swap/src/protocol/bob/event_loop.rs @@ -12,7 +12,7 @@ use futures::FutureExt; use libp2p::{core::Multiaddr, PeerId}; use std::{convert::Infallible, sync::Arc}; use tokio::sync::mpsc::{Receiver, Sender}; -use tracing::{debug, error, info}; +use tracing::{debug, error, info, trace}; #[derive(Debug)] pub struct Channels { @@ -200,7 +200,7 @@ impl EventLoop { if option.is_some() { let peer_id = self.alice_peer_id; if self.swarm.pt.is_connected(&peer_id) { - debug!("Already connected to Alice: {}", peer_id); + trace!("Already connected to Alice at {}", peer_id); let _ = self.conn_established.send(peer_id).await; } else { info!("dialing alice: {}", peer_id); diff --git a/swap/src/protocol/bob/state.rs b/swap/src/protocol/bob/state.rs index 10cdc378..83e75eca 100644 --- a/swap/src/protocol/bob/state.rs +++ b/swap/src/protocol/bob/state.rs @@ -275,7 +275,7 @@ impl State2 { { let signed_tx_lock = bitcoin_wallet.sign_tx_lock(self.tx_lock.clone()).await?; - tracing::info!("{}", self.tx_lock.txid()); + tracing::debug!("locking BTC in transaction {}", self.tx_lock.txid()); let _ = bitcoin_wallet .broadcast_signed_transaction(signed_tx_lock) .await?; diff --git a/swap/src/protocol/bob/swap.rs b/swap/src/protocol/bob/swap.rs index 76bf0890..5f499ea8 100644 --- a/swap/src/protocol/bob/swap.rs +++ b/swap/src/protocol/bob/swap.rs @@ -12,7 +12,7 @@ use async_recursion::async_recursion; use rand::rngs::OsRng; use std::sync::Arc; use tokio::select; -use tracing::info; +use tracing::{trace, warn}; use uuid::Uuid; pub fn is_complete(state: &BobState) -> bool { @@ -61,7 +61,7 @@ async fn run_until_internal( swap_id: Uuid, execution_params: ExecutionParams, ) -> Result { - info!("Current state: {}", state); + trace!("Current state: {}", state); if is_target_state(&state) { Ok(state) } else { @@ -186,7 +186,7 @@ async fn run_until_internal( match state4? { Ok(state4) => BobState::XmrLocked(state4), Err(InsufficientFunds {..}) => { - info!("The other party has locked insufficient Monero funds! Waiting for refund..."); + warn!("The other party has locked insufficient Monero funds! Waiting for refund..."); state.wait_for_cancel_timelock_to_expire(bitcoin_wallet.as_ref()).await?; let state4 = state.cancel(); BobState::CancelTimelockExpired(state4) diff --git a/swap/src/seed.rs b/swap/src/seed.rs index 48c9d039..ebcf6135 100644 --- a/swap/src/seed.rs +++ b/swap/src/seed.rs @@ -45,7 +45,7 @@ impl Seed { return Self::from_file(&file_path); } - tracing::info!("No seed file found, creating at: {}", file_path.display()); + tracing::debug!("No seed file found, creating at: {}", file_path.display()); let random_seed = Seed::random()?; random_seed.write_to(file_path.to_path_buf())?; @@ -61,7 +61,7 @@ impl Seed { let contents = fs::read_to_string(file)?; let pem = pem::parse(contents)?; - tracing::info!("Read in seed from file: {}", file.display()); + tracing::trace!("Read in seed from {}", file.display()); Self::from_pem(pem) }