Address PR comments
[rust-lightning] / src / ln / channel.rs
index 237ccd840f561a86d89d915bf2c4c635157f37b7..cd529f5c80120c47dc89da26c786b6e121d5f13d 100644 (file)
@@ -271,7 +271,13 @@ pub(super) struct Channel {
        // is received. holding_cell_update_fee is updated when there are additional
        // update_fee() during ChannelState::AwaitingRemoteRevoke.
        holding_cell_update_fee: Option<u64>,
+       #[cfg(test)]
+       pub next_local_htlc_id: u64,
+       #[cfg(not(test))]
        next_local_htlc_id: u64,
+       #[cfg(test)]
+       pub next_remote_htlc_id: u64,
+       #[cfg(not(test))]
        next_remote_htlc_id: u64,
        channel_update_count: u32,
        feerate_per_kw: u64,
@@ -307,6 +313,9 @@ pub(super) struct Channel {
        pub(super) our_dust_limit_satoshis: u64,
        #[cfg(not(test))]
        our_dust_limit_satoshis: u64,
+       #[cfg(test)]
+       pub(super) their_max_htlc_value_in_flight_msat: u64,
+       #[cfg(not(test))]
        their_max_htlc_value_in_flight_msat: u64,
        //get_our_max_htlc_value_in_flight_msat(): u64,
        /// minimum channel reserve for **self** to maintain - set by them.
@@ -316,6 +325,9 @@ pub(super) struct Channel {
        our_htlc_minimum_msat: u64,
        their_to_self_delay: u16,
        //implied by BREAKDOWN_TIMEOUT: our_to_self_delay: u16,
+       #[cfg(test)]
+       pub their_max_accepted_htlcs: u16,
+       #[cfg(not(test))]
        their_max_accepted_htlcs: u16,
        //implied by OUR_MAX_HTLCS: our_max_accepted_htlcs: u16,
        minimum_depth: u32,
@@ -337,7 +349,7 @@ pub(super) struct Channel {
        logger: Arc<Logger>,
 }
 
-const OUR_MAX_HTLCS: u16 = 50; //TODO
+pub const OUR_MAX_HTLCS: u16 = 50; //TODO
 /// Confirmation count threshold at which we close a channel. Ideally we'd keep the channel around
 /// on ice until the funding transaction gets more confirmations, but the LN protocol doesn't
 /// really allow for this, so instead we're stuck closing it out at that point.
@@ -382,7 +394,7 @@ macro_rules! secp_check {
 
 impl Channel {
        // Convert constants + channel value to limits:
-       fn get_our_max_htlc_value_in_flight_msat(channel_value_satoshis: u64) -> u64 {
+       pub fn get_our_max_htlc_value_in_flight_msat(channel_value_satoshis: u64) -> u64 {
                channel_value_satoshis * 1000 / 10 //TODO
        }