Skip to content

Commit

Permalink
Refactor channelmanager tests to test publicly visible apis
Browse files Browse the repository at this point in the history
* Few tests were dependent on channelmanagers internal state, refactored
  that them to publicly visible apis
  • Loading branch information
srikanth-iyengar committed May 14, 2024
1 parent 093edef commit e4dfd72
Show file tree
Hide file tree
Showing 5 changed files with 740 additions and 19 deletions.
7 changes: 4 additions & 3 deletions lightning/src/ln/anchor_channel_configuration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use crate::events::{Event, MessageSendEvent, MessageSendEventsProvider};
use crate::ln::msgs::ChannelMessageHandler;
use crate::ln::types::ChannelId;
use crate::ln::functional_test_utils::*;
use crate::ln::msgs::ErrorAction;
use crate::ln::{functional_test_utils::*, ChannelId};
use crate::ln::msgs::ChannelMessageHandler;
use crate::prelude::*;
use crate::util::config::ChannelConfigUpdate;
use crate::util::errors::APIError;
use crate::util::config::ChannelConfigUpdate;

#[test]
fn test_inbound_anchors_manual_acceptance() {
Expand Down
6 changes: 3 additions & 3 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2284,15 +2284,15 @@ pub(crate) const ENABLE_GOSSIP_TICKS: u8 = 5;
/// The maximum number of unfunded channels we can have per-peer before we start rejecting new
/// (inbound) ones. The number of peers with unfunded channels is limited separately in
/// [`MAX_UNFUNDED_CHANNEL_PEERS`].
const MAX_UNFUNDED_CHANS_PER_PEER: usize = 4;
pub(crate) const MAX_UNFUNDED_CHANS_PER_PEER: usize = 4;

/// The maximum number of peers from which we will allow pending unfunded channels. Once we reach
/// this many peers we reject new (inbound) channels from peers with which we don't have a channel.
const MAX_UNFUNDED_CHANNEL_PEERS: usize = 50;
pub(crate) const MAX_UNFUNDED_CHANNEL_PEERS: usize = 50;

/// The maximum number of peers which we do not have a (funded) channel with. Once we reach this
/// many peers we reject new (inbound) connections.
const MAX_NO_CHANNEL_PEERS: usize = 250;
pub(crate) const MAX_NO_CHANNEL_PEERS: usize = 250;

/// Information needed for constructing an invoice route hint for this channel.
#[derive(Clone, Debug, PartialEq)]
Expand Down

0 comments on commit e4dfd72

Please sign in to comment.