From b8ab4b4eee0692f98db55426a3010db6ef9d1e72 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 29 Oct 2020 11:36:57 +1100 Subject: [PATCH] wip: add env filter --- swap/Cargo.toml | 2 +- swap/src/network/request_response.rs | 9 ++++++--- swap/tests/e2e.rs | 12 ++++-------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/swap/Cargo.toml b/swap/Cargo.toml index 6b57107e..475fb6a0 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -12,7 +12,7 @@ atty = "0.2" backoff = { version = "0.2", features = ["tokio"] } base64 = "0.12" bitcoin = { version = "0.23", features = ["rand", "use-serde"] } # TODO: Upgrade other crates in this repo to use this version. -bitcoin-harness = { git = "https://github.com/coblox/bitcoin-harness-rs", rev = "7ff30a559ab57cc3aa71189e71433ef6b2a6c3a2" } +bitcoin-harness = { git = "https://github.com/coblox/bitcoin-harness-rs", rev = "b56ac243eade11e817aa670d546892852a609e7d" } derivative = "2" futures = { version = "0.3", default-features = false } genawaiter = "0.99.1" diff --git a/swap/src/network/request_response.rs b/swap/src/network/request_response.rs index 4950b818..7026626e 100644 --- a/swap/src/network/request_response.rs +++ b/swap/src/network/request_response.rs @@ -70,7 +70,7 @@ impl RequestResponseCodec for Codec { .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?; let mut de = serde_cbor::Deserializer::from_slice(&message); let msg = BobToAlice::deserialize(&mut de) - .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?; + .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; Ok(msg) } @@ -102,8 +102,11 @@ impl RequestResponseCodec for Codec { where T: AsyncWrite + Unpin + Send, { - let bytes = - serde_cbor::to_vec(&req).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?; + let bytes = serde_cbor::to_vec(&req).map_err(|e| { + tracing::debug!("yes Lucas we are actually here"); + io::Error::new(io::ErrorKind::InvalidData, e) + })?; + upgrade::write_one(io, &bytes).await?; Ok(()) diff --git a/swap/tests/e2e.rs b/swap/tests/e2e.rs index 61f6aabd..8a4c0a34 100644 --- a/swap/tests/e2e.rs +++ b/swap/tests/e2e.rs @@ -1,7 +1,6 @@ use bitcoin_harness::Bitcoind; use futures::{channel::mpsc, future::try_join}; use libp2p::Multiaddr; -use log::LevelFilter; use monero_harness::Monero; use std::sync::Arc; use swap::{alice, bob}; @@ -11,13 +10,10 @@ use tracing_subscriber::util::SubscriberInitExt; #[tokio::test] async fn swap() { let _guard = tracing_subscriber::fmt() - .with_env_filter(format!( - "swap={},xmr_btc={},libp2p={}", - LevelFilter::Debug, - LevelFilter::Debug, - LevelFilter::Debug - )) - .with_ansi(false) + .with_env_filter( + "swap=debug,hyper=off,reqwest=off,monero-harness=info,testcontainers=info,libp2p=debug", + ) + .with_ansi(true) .set_default(); let alice_multiaddr: Multiaddr = "/ip4/127.0.0.1/tcp/9876"