mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-07-01 00:51:23 +00:00
Demote / promote log messages to their appropriate level
This commit is contained in:
parent
7387884e6d
commit
bbbe5f7ae8
|
@ -35,7 +35,7 @@ use swap::{
|
||||||
},
|
},
|
||||||
seed::Seed,
|
seed::Seed,
|
||||||
};
|
};
|
||||||
use tracing::{debug, error, info, warn, Level};
|
use tracing::{debug, error, warn, Level};
|
||||||
use tracing_subscriber::FmtSubscriber;
|
use tracing_subscriber::FmtSubscriber;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ async fn main() -> Result<()> {
|
||||||
None => Config::testnet(),
|
None => Config::testnet(),
|
||||||
};
|
};
|
||||||
|
|
||||||
info!(
|
debug!(
|
||||||
"Database and Seed will be stored in directory: {}",
|
"Database and seed will be stored in {}",
|
||||||
config.data.dir.display()
|
config.data.dir.display()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ async fn main() -> Result<()> {
|
||||||
cancel_result = cancel => {
|
cancel_result = cancel => {
|
||||||
match cancel_result? {
|
match cancel_result? {
|
||||||
Ok((txid, _)) => {
|
Ok((txid, _)) => {
|
||||||
info!("Cancel transaction successfully published with id {}", txid)
|
debug!("Cancel transaction successfully published with id {}", txid)
|
||||||
}
|
}
|
||||||
Err(CancelError::CancelTimelockNotExpiredYet) => error!(
|
Err(CancelError::CancelTimelockNotExpiredYet) => error!(
|
||||||
"The Cancel Transaction cannot be published yet, \
|
"The Cancel Transaction cannot be published yet, \
|
||||||
|
@ -353,7 +353,7 @@ async fn init_wallets(
|
||||||
monero_wallet_rpc_url
|
monero_wallet_rpc_url
|
||||||
))?;
|
))?;
|
||||||
|
|
||||||
info!(
|
debug!(
|
||||||
"Created Monero wallet for blockchain monitoring with name {}",
|
"Created Monero wallet for blockchain monitoring with name {}",
|
||||||
MONERO_BLOCKCHAIN_MONITORING_WALLET_NAME
|
MONERO_BLOCKCHAIN_MONITORING_WALLET_NAME
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,7 +6,7 @@ use std::{
|
||||||
ffi::OsStr,
|
ffi::OsStr,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
use tracing::info;
|
use tracing::debug;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
pub const DEFAULT_ELECTRUM_HTTP_URL: &str = "https://blockstream.info/testnet/api/";
|
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<Result<Config, ConfigNotInitialized>> {
|
pub fn read_config(config_path: PathBuf) -> Result<Result<Config, ConfigNotInitialized>> {
|
||||||
if config_path.exists() {
|
if config_path.exists() {
|
||||||
info!(
|
debug!(
|
||||||
"Using config file at default path: {}",
|
"Using config file at default path: {}",
|
||||||
config_path.display()
|
config_path.display()
|
||||||
);
|
);
|
||||||
|
|
|
@ -89,14 +89,17 @@ impl Transfer for Wallet {
|
||||||
.transfer(0, amount.as_piconero(), &destination_address.to_string())
|
.transfer(0, amount.as_piconero(), &destination_address.to_string())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let tx_hash = TxHash(res.tx_hash);
|
tracing::debug!(
|
||||||
tracing::info!("Monero tx broadcasted!, tx hash: {:?}", tx_hash);
|
"sent transfer of {} to {} in {}",
|
||||||
let tx_key = PrivateKey::from_str(&res.tx_key)?;
|
amount,
|
||||||
|
public_spend_key,
|
||||||
|
res.tx_hash
|
||||||
|
);
|
||||||
|
|
||||||
let transfer_proof = TransferProof::new(tx_hash, tx_key);
|
Ok(TransferProof::new(
|
||||||
tracing::debug!(" Transfer proof: {:?}", transfer_proof);
|
TxHash(res.tx_hash),
|
||||||
|
PrivateKey::from_str(&res.tx_key)?,
|
||||||
Ok(transfer_proof)
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ use futures::FutureExt;
|
||||||
use libp2p::{core::Multiaddr, PeerId};
|
use libp2p::{core::Multiaddr, PeerId};
|
||||||
use std::{convert::Infallible, sync::Arc};
|
use std::{convert::Infallible, sync::Arc};
|
||||||
use tokio::sync::mpsc::{Receiver, Sender};
|
use tokio::sync::mpsc::{Receiver, Sender};
|
||||||
use tracing::{debug, error, info};
|
use tracing::{debug, error, info, trace};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Channels<T> {
|
pub struct Channels<T> {
|
||||||
|
@ -200,7 +200,7 @@ impl EventLoop {
|
||||||
if option.is_some() {
|
if option.is_some() {
|
||||||
let peer_id = self.alice_peer_id;
|
let peer_id = self.alice_peer_id;
|
||||||
if self.swarm.pt.is_connected(&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;
|
let _ = self.conn_established.send(peer_id).await;
|
||||||
} else {
|
} else {
|
||||||
info!("dialing alice: {}", peer_id);
|
info!("dialing alice: {}", peer_id);
|
||||||
|
|
|
@ -275,7 +275,7 @@ impl State2 {
|
||||||
{
|
{
|
||||||
let signed_tx_lock = bitcoin_wallet.sign_tx_lock(self.tx_lock.clone()).await?;
|
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
|
let _ = bitcoin_wallet
|
||||||
.broadcast_signed_transaction(signed_tx_lock)
|
.broadcast_signed_transaction(signed_tx_lock)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
|
@ -12,7 +12,7 @@ use async_recursion::async_recursion;
|
||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::select;
|
use tokio::select;
|
||||||
use tracing::info;
|
use tracing::{trace, warn};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
pub fn is_complete(state: &BobState) -> bool {
|
pub fn is_complete(state: &BobState) -> bool {
|
||||||
|
@ -61,7 +61,7 @@ async fn run_until_internal(
|
||||||
swap_id: Uuid,
|
swap_id: Uuid,
|
||||||
execution_params: ExecutionParams,
|
execution_params: ExecutionParams,
|
||||||
) -> Result<BobState> {
|
) -> Result<BobState> {
|
||||||
info!("Current state: {}", state);
|
trace!("Current state: {}", state);
|
||||||
if is_target_state(&state) {
|
if is_target_state(&state) {
|
||||||
Ok(state)
|
Ok(state)
|
||||||
} else {
|
} else {
|
||||||
|
@ -186,7 +186,7 @@ async fn run_until_internal(
|
||||||
match state4? {
|
match state4? {
|
||||||
Ok(state4) => BobState::XmrLocked(state4),
|
Ok(state4) => BobState::XmrLocked(state4),
|
||||||
Err(InsufficientFunds {..}) => {
|
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?;
|
state.wait_for_cancel_timelock_to_expire(bitcoin_wallet.as_ref()).await?;
|
||||||
let state4 = state.cancel();
|
let state4 = state.cancel();
|
||||||
BobState::CancelTimelockExpired(state4)
|
BobState::CancelTimelockExpired(state4)
|
||||||
|
|
|
@ -45,7 +45,7 @@ impl Seed {
|
||||||
return Self::from_file(&file_path);
|
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()?;
|
let random_seed = Seed::random()?;
|
||||||
random_seed.write_to(file_path.to_path_buf())?;
|
random_seed.write_to(file_path.to_path_buf())?;
|
||||||
|
@ -61,7 +61,7 @@ impl Seed {
|
||||||
let contents = fs::read_to_string(file)?;
|
let contents = fs::read_to_string(file)?;
|
||||||
let pem = pem::parse(contents)?;
|
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)
|
Self::from_pem(pem)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user