Skip to content

Commit f12bf1c

Browse files
committed
Use upstream TestLogger util in tx sync tests
1 parent b3e7aac commit f12bf1c

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

lightning-transaction-sync/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ esplora-client = { version = "0.4", default-features = false, optional = true }
2929
reqwest = { version = "0.11", optional = true, default-features = false, features = ["json"] }
3030

3131
[dev-dependencies]
32-
lightning = { version = "0.0.118", path = "../lightning", features = ["std"] }
32+
lightning = { version = "0.0.118", path = "../lightning", features = ["std", "_test_utils"] }
3333
electrsd = { version = "0.22.0", features = ["legacy", "esplora_a33e97e1", "bitcoind_23_0"] }
3434
electrum-client = "0.12.0"
3535
tokio = { version = "1.14.0", features = ["full"] }

lightning-transaction-sync/tests/integration_tests.rs

+3-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use lightning_transaction_sync::EsploraSyncClient;
33
use lightning::chain::{Confirm, Filter};
44
use lightning::chain::transaction::TransactionData;
5-
use lightning::util::logger::{Logger, Record};
5+
use lightning::util::test_utils::TestLogger;
66

77
use electrsd::{bitcoind, bitcoind::BitcoinD, ElectrsD};
88
use bitcoin::{Amount, Txid, BlockHash, BlockHeader};
@@ -146,22 +146,12 @@ impl Confirm for TestConfirmable {
146146
}
147147
}
148148

149-
pub struct TestLogger {}
150-
151-
impl Logger for TestLogger {
152-
fn log(&self, record: &Record) {
153-
println!("{} -- {}",
154-
record.level,
155-
record.args);
156-
}
157-
}
158-
159149
#[test]
160150
#[cfg(feature = "esplora-blocking")]
161151
fn test_esplora_syncs() {
162152
let (bitcoind, electrsd) = setup_bitcoind_and_electrsd();
163153
generate_blocks_and_wait(&bitcoind, &electrsd, 101);
164-
let mut logger = TestLogger {};
154+
let mut logger = TestLogger::new();
165155
let esplora_url = format!("http://{}", electrsd.esplora_url.as_ref().unwrap());
166156
let tx_sync = EsploraSyncClient::new(esplora_url, &mut logger);
167157
let confirmable = TestConfirmable::new();
@@ -244,7 +234,7 @@ fn test_esplora_syncs() {
244234
async fn test_esplora_syncs() {
245235
let (bitcoind, electrsd) = setup_bitcoind_and_electrsd();
246236
generate_blocks_and_wait(&bitcoind, &electrsd, 101);
247-
let mut logger = TestLogger {};
237+
let mut logger = TestLogger::new();
248238
let esplora_url = format!("http://{}", electrsd.esplora_url.as_ref().unwrap());
249239
let tx_sync = EsploraSyncClient::new(esplora_url, &mut logger);
250240
let confirmable = TestConfirmable::new();

0 commit comments

Comments
 (0)