Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lightning/src/chain/chainmonitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ where C::Target: chain::Filter,
self.event_notifier.notify();
}

#[cfg(any(test, fuzzing, feature = "_test_utils"))]
#[cfg(any(test, feature = "_test_utils"))]
pub fn get_and_clear_pending_events(&self) -> Vec<events::Event> {
use crate::events::EventsProvider;
let events = core::cell::RefCell::new(Vec::new());
Expand Down
4 changes: 2 additions & 2 deletions lightning/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
//! * `max_level_trace`

#![cfg_attr(not(any(test, fuzzing, feature = "_test_utils")), deny(missing_docs))]
#![cfg_attr(not(any(test, fuzzing, feature = "_test_utils")), forbid(unsafe_code))]
#![cfg_attr(not(any(test, feature = "_test_utils")), forbid(unsafe_code))]

// Prefix these with `rustdoc::` when we update our MSRV to be >= 1.52 to remove warnings.
#![deny(broken_intra_doc_links)]
Expand Down Expand Up @@ -67,7 +67,7 @@ extern crate bitcoin;
extern crate core;

#[cfg(any(test, feature = "_test_utils"))] extern crate hex;
#[cfg(any(test, fuzzing, feature = "_test_utils"))] extern crate regex;
#[cfg(any(test, feature = "_test_utils"))] extern crate regex;

#[cfg(not(feature = "std"))] extern crate core2;

Expand Down
2 changes: 1 addition & 1 deletion lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6171,7 +6171,7 @@ where
inflight_htlcs
}

#[cfg(any(test, fuzzing, feature = "_test_utils"))]
#[cfg(any(test, feature = "_test_utils"))]
pub fn get_and_clear_pending_events(&self) -> Vec<events::Event> {
let events = core::cell::RefCell::new(Vec::new());
let event_handler = |event: events::Event| events.borrow_mut().push(event);
Expand Down
4 changes: 2 additions & 2 deletions lightning/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ pub(crate) mod crypto;
pub mod logger;
pub mod config;

#[cfg(any(test, fuzzing, feature = "_test_utils"))]
#[cfg(any(test, feature = "_test_utils"))]
pub mod test_utils;

/// impls of traits that add exra enforcement on the way they're called. Useful for detecting state
/// machine errors and used in fuzz targets and tests.
#[cfg(any(test, fuzzing, feature = "_test_utils"))]
#[cfg(any(test, feature = "_test_utils"))]
pub mod enforcing_trait_impls;

2 changes: 2 additions & 0 deletions lightning/src/util/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ use bitcoin::secp256k1::{SecretKey, PublicKey, Secp256k1, ecdsa::Signature, Scal
use bitcoin::secp256k1::ecdh::SharedSecret;
use bitcoin::secp256k1::ecdsa::RecoverableSignature;

#[cfg(any(test, feature = "_test_utils"))]
use regex;

use crate::io;
Expand Down Expand Up @@ -738,6 +739,7 @@ impl TestLogger {
/// 1. belong to the specified module and
/// 2. match the given regex pattern.
/// Assert that the number of occurrences equals the given `count`
#[cfg(any(test, feature = "_test_utils"))]
pub fn assert_log_regex(&self, module: &str, pattern: regex::Regex, count: usize) {
let log_entries = self.lines.lock().unwrap();
let l: usize = log_entries.iter().filter(|&(&(ref m, ref l), _c)| {
Expand Down