From 187ca8c0c8439df29c8a767680f0190ec88be529 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 27 Mar 2018 11:18:10 -0400 Subject: [PATCH] Make Channel non-public except in fuzztarget mode, bump version --- Cargo.toml | 2 +- src/ln/channelmanager.rs | 6 +++--- src/ln/mod.rs | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3e07441c1..8e1946b1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lightning" -version = "0.0.1" +version = "0.0.2" authors = ["Matt Corallo"] license = "Apache-2.0" repository = "https://github.com/TheBlueMatt/rust-lightning/" diff --git a/src/ln/channelmanager.rs b/src/ln/channelmanager.rs index 8be2348a7..ff78a27df 100644 --- a/src/ln/channelmanager.rs +++ b/src/ln/channelmanager.rs @@ -41,8 +41,8 @@ pub struct PendingForwardHTLCInfo { amt_to_forward: u64, outgoing_cltv_value: u32, } -//TODO: This is public, and needed to call Channel::update_add_htlc, so there needs to be a way to -//initialize it usefully...probably make it optional in Channel instead). + +#[cfg(feature = "fuzztarget")] impl PendingForwardHTLCInfo { pub fn dummy() -> Self { Self { @@ -635,7 +635,7 @@ impl ChannelManager { let mut channel_state_lock = self.channel_state.lock().unwrap(); let channel_state = channel_state_lock.borrow_parts(); - if Instant::now() < *channel_state.next_forward { + if cfg!(not(feature = "fuzztarget")) && Instant::now() < *channel_state.next_forward { return; } diff --git a/src/ln/mod.rs b/src/ln/mod.rs index 1f5fa460a..7cd4272e1 100644 --- a/src/ln/mod.rs +++ b/src/ln/mod.rs @@ -1,9 +1,13 @@ pub mod channelmanager; -pub mod channel; pub mod channelmonitor; pub mod msgs; pub mod router; pub mod peer_channel_encryptor; pub mod peer_handler; +#[cfg(feature = "fuzztarget")] +pub mod channel; +#[cfg(not(feature = "fuzztarget"))] +pub(crate) mod channel; + mod chan_utils; -- 2.39.5