From: Elias Rohrer Date: Wed, 25 Oct 2023 08:59:13 +0000 (+0200) Subject: Use upstream `TestLogger` util in tx sync tests X-Git-Tag: v0.0.119~44^2~8 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=5b7c1d511b724ef768f67e81556bff20853109fa;p=rust-lightning Use upstream `TestLogger` util in tx sync tests --- diff --git a/lightning-transaction-sync/Cargo.toml b/lightning-transaction-sync/Cargo.toml index 782c4b70..9b85042f 100644 --- a/lightning-transaction-sync/Cargo.toml +++ b/lightning-transaction-sync/Cargo.toml @@ -29,7 +29,7 @@ esplora-client = { version = "0.6", default-features = false, optional = true } reqwest = { version = "0.11", optional = true, default-features = false, features = ["json"] } [dev-dependencies] -lightning = { version = "0.0.118", path = "../lightning", features = ["std"] } +lightning = { version = "0.0.118", path = "../lightning", features = ["std", "_test_utils"] } electrsd = { version = "0.26.0", features = ["legacy", "esplora_a33e97e1", "bitcoind_25_0"] } electrum-client = "0.18.0" tokio = { version = "1.14.0", features = ["full"] } diff --git a/lightning-transaction-sync/tests/integration_tests.rs b/lightning-transaction-sync/tests/integration_tests.rs index 218d187a..358f49a8 100644 --- a/lightning-transaction-sync/tests/integration_tests.rs +++ b/lightning-transaction-sync/tests/integration_tests.rs @@ -2,7 +2,7 @@ use lightning_transaction_sync::EsploraSyncClient; use lightning::chain::{Confirm, Filter}; use lightning::chain::transaction::TransactionData; -use lightning::util::logger::{Logger, Record}; +use lightning::util::test_utils::TestLogger; use electrsd::{bitcoind, bitcoind::BitcoinD, ElectrsD}; use bitcoin::{Amount, Txid, BlockHash}; @@ -148,22 +148,12 @@ impl Confirm for TestConfirmable { } } -pub struct TestLogger {} - -impl Logger for TestLogger { - fn log(&self, record: &Record) { - println!("{} -- {}", - record.level, - record.args); - } -} - #[test] #[cfg(feature = "esplora-blocking")] fn test_esplora_syncs() { let (bitcoind, electrsd) = setup_bitcoind_and_electrsd(); generate_blocks_and_wait(&bitcoind, &electrsd, 101); - let mut logger = TestLogger {}; + let mut logger = TestLogger::new(); let esplora_url = format!("http://{}", electrsd.esplora_url.as_ref().unwrap()); let tx_sync = EsploraSyncClient::new(esplora_url, &mut logger); let confirmable = TestConfirmable::new(); @@ -246,7 +236,7 @@ fn test_esplora_syncs() { async fn test_esplora_syncs() { let (bitcoind, electrsd) = setup_bitcoind_and_electrsd(); generate_blocks_and_wait(&bitcoind, &electrsd, 101); - let mut logger = TestLogger {}; + let mut logger = TestLogger::new(); let esplora_url = format!("http://{}", electrsd.esplora_url.as_ref().unwrap()); let tx_sync = EsploraSyncClient::new(esplora_url, &mut logger); let confirmable = TestConfirmable::new();