Rename test default channel config
What changed, and why it matters
This commit is a pure test-code refactoring. It renames the default test channel configuration because anchor channels became the production default, and updates many tests to explicitly use a new 'legacy' configuration where they previously relied on the old default. There is no change to production code, no bug fix, and no security-relevant behavior change.
No action required. This is a test-only refactor; review can be limited to confirming no production code paths were modified.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change renames test_default_channel_config() to test_legacy_channel_config() and test_default_anchors_channel_config() to test_default_channel_config(). It then updates test call sites to use the legacy config where the tests were written assuming the pre-anchor default, and uses the new default (anchors enabled) in tests that explicitly want anchor channels. A few tests are adjusted to remove redundant anchor-enabling flags. All modifications are inside #[cfg(test)] / mod tests blocks or test utility files.
Changed components
lightning/src/ln/functional_test_utils.rslightning/src/ln/functional_tests.rslightning/src/ln/channel_open_tests.rslightning/src/ln/channelmanager.rslightning/src/ln/payment_tests.rslightning/src/ln/monitor_tests.rslightning/src/ln/reload_tests.rslightning/src/ln/reorg_tests.rslightning/src/ln/shutdown_tests.rslightning/src/ln/splicing_tests.rslightning/src/ln/update_fee_tests.rslightning/src/ln/htlc_reserve_unit_tests.rslightning/src/ln/invoice_utils.rslightning/src/ln/chanmon_update_fail_tests.rslightning/src/chain/chainmonitor.rslightning/src/chain/channelmonitor.rslightning/src/util/persist.rslightning-persister/src/test_utils.rsInspect captured patch +329 / −146
diff --git a/lightning-persister/src/test_utils.rs b/lightning-persister/src/test_utils.rs
index 55208c6..48b383a 100644
--- a/lightning-persister/src/test_utils.rs
+++ b/lightning-persister/src/test_utils.rs
@@ -132,7 +132,9 @@ pub(crate) fn do_test_store<K: KVStoreSync + Sync>(store_0: &K, store_1: &K) {
);
node_cfgs[0].chain_monitor = chain_mon_0;
node_cfgs[1].chain_monitor = chain_mon_1;
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_b_id = nodes[1].node.get_our_node_id();
diff --git a/lightning/src/chain/chainmonitor.rs b/lightning/src/chain/chainmonitor.rs
index 17693f8..7db1b69 100644
--- a/lightning/src/chain/chainmonitor.rs
+++ b/lightning/src/chain/chainmonitor.rs
@@ -1687,7 +1687,12 @@ mod tests {
fn test_chainsync_triggers_distributed_monitor_persistence() {
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs
index c7dd579..3e1138c 100644
--- a/lightning/src/chain/channelmonitor.rs
+++ b/lightning/src/chain/channelmonitor.rs
@@ -6808,7 +6808,8 @@ mod tests {
// updates is handled correctly in such conditions.
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let channel = create_announced_chan_between_nodes(&nodes, 0, 1);
create_announced_chan_between_nodes(&nodes, 1, 2);
diff --git a/lightning/src/ln/chanmon_update_fail_tests.rs b/lightning/src/ln/chanmon_update_fail_tests.rs
index 6cf7bce..4475def 100644
--- a/lightning/src/ln/chanmon_update_fail_tests.rs
+++ b/lightning/src/ln/chanmon_update_fail_tests.rs
@@ -3779,7 +3779,12 @@ fn do_test_durable_preimages_on_closed_channel(
let chain_mon;
let node_b_reload;
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), None],
+ );
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -3974,7 +3979,8 @@ fn do_test_reload_mon_update_completion_actions(close_during_reload: bool) {
let chain_mon;
let node_b_reload;
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[Some(legacy_cfg), None, None]);
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_b_id = nodes[1].node.get_our_node_id();
@@ -4462,7 +4468,9 @@ fn test_claim_to_closed_channel_blocks_forwarded_preimage_removal() {
// This tests that behavior.
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(3, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg), None]);
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -4543,7 +4551,8 @@ fn test_claim_to_closed_channel_blocks_claimed_event() {
// This tests that behavior.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg), None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
diff --git a/lightning/src/ln/channel_open_tests.rs b/lightning/src/ln/channel_open_tests.rs
index f1336a0..30276ca 100644
--- a/lightning/src/ln/channel_open_tests.rs
+++ b/lightning/src/ln/channel_open_tests.rs
@@ -172,7 +172,7 @@ fn test_0conf_limiting() {
#[test]
fn test_inbound_anchors_manual_acceptance() {
- let anchors_cfg = test_default_anchors_channel_config();
+ let anchors_cfg = test_default_channel_config();
do_test_manual_inbound_accept_with_override(anchors_cfg, None);
}
@@ -190,7 +190,7 @@ fn test_inbound_anchors_config_overridden() {
update_overrides: None,
};
- let mut anchors_cfg = test_default_anchors_channel_config();
+ let mut anchors_cfg = test_default_channel_config();
let accept_message = do_test_manual_inbound_accept_with_override(anchors_cfg, Some(overrides));
assert_eq!(accept_message.common_fields.max_htlc_value_in_flight_msat, 5_000_000);
assert_eq!(accept_message.common_fields.htlc_minimum_msat, 1_000);
@@ -306,9 +306,8 @@ fn test_zero_fee_commitments_downgrade_to_static_remote() {
// are supported (but not accepted), but not legacy anchors.
let mut initiator_cfg = test_default_channel_config();
initiator_cfg.channel_handshake_config.negotiate_anchor_zero_fee_commitments = true;
- initiator_cfg.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
- let mut receiver_cfg = test_default_channel_config();
+ let mut receiver_cfg = test_legacy_channel_config();
receiver_cfg.channel_handshake_config.negotiate_anchor_zero_fee_commitments = true;
let start_type = ChannelTypeFeatures::anchors_zero_fee_commitments();
@@ -367,9 +366,8 @@ fn do_test_channel_type_downgrade(
fn test_no_channel_downgrade() {
// Tests that the local node will not retry when a `option_static_remote` channel is
// rejected by a peer that advertises support for the feature.
- let initiator_cfg = test_default_channel_config();
+ let initiator_cfg = test_legacy_channel_config();
let mut receiver_cfg = test_default_channel_config();
- receiver_cfg.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
@@ -459,11 +457,11 @@ fn test_channel_resumption_fail_post_funding() {
pub fn test_insane_channel_opens() {
// Stand up a network of 2 nodes
use crate::ln::channel::TOTAL_BITCOIN_SUPPLY_SATOSHIS;
- let mut cfg = UserConfig::default();
- cfg.channel_handshake_limits.max_funding_satoshis = TOTAL_BITCOIN_SUPPLY_SATOSHIS + 1;
+ let mut legacy_cfg = test_legacy_channel_config();
+ legacy_cfg.channel_handshake_limits.max_funding_satoshis = TOTAL_BITCOIN_SUPPLY_SATOSHIS + 1;
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, Some(cfg.clone())]);
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, Some(legacy_cfg.clone())]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -473,7 +471,7 @@ pub fn test_insane_channel_opens() {
// funding satoshis
let channel_value_sat = 31337; // same as funding satoshis
let channel_reserve_satoshis =
- get_holder_selected_channel_reserve_satoshis(channel_value_sat, &cfg);
+ get_holder_selected_channel_reserve_satoshis(channel_value_sat, &legacy_cfg);
let push_msat = (channel_value_sat - channel_reserve_satoshis) * 1000;
// Have node0 initiate a channel to node1 with aforementioned parameters
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index a160907..b6c4585 100644
--- a/lightning/src/ln/channelmanager.rs
+++ b/lightning/src/ln/channelmanager.rs
@@ -20398,7 +20398,7 @@ mod tests {
fn test_trigger_lnd_force_close() {
let chanmon_cfg = create_chanmon_cfgs(2);
let node_cfg = create_node_cfgs(2, &chanmon_cfg);
- let user_config = test_default_channel_config();
+ let user_config = test_legacy_channel_config();
let node_chanmgr = create_node_chanmgrs(2, &node_cfg, &[Some(user_config.clone()), Some(user_config)]);
let nodes = create_network(2, &node_cfg, &node_chanmgr);
let message = "Channel force-closed".to_owned();
diff --git a/lightning/src/ln/functional_test_utils.rs b/lightning/src/ln/functional_test_utils.rs
index 6ed6f5e..2560e77 100644
--- a/lightning/src/ln/functional_test_utils.rs
+++ b/lightning/src/ln/functional_test_utils.rs
@@ -4532,7 +4532,7 @@ pub fn create_node_cfgs_with_node_id_message_router<'a>(
)
}
-pub fn test_default_channel_config() -> UserConfig {
+pub fn test_legacy_channel_config() -> UserConfig {
let mut default_config = UserConfig::default();
default_config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = false;
// Set cltv_expiry_delta slightly lower to keep the final CLTV values inside one byte in our
@@ -4552,8 +4552,8 @@ pub fn test_default_channel_config() -> UserConfig {
default_config
}
-pub fn test_default_anchors_channel_config() -> UserConfig {
- let mut config = test_default_channel_config();
+pub fn test_default_channel_config() -> UserConfig {
+ let mut config = test_legacy_channel_config();
config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
config
}
diff --git a/lightning/src/ln/functional_tests.rs b/lightning/src/ln/functional_tests.rs
index 990f1d5..1db31a5 100644
--- a/lightning/src/ln/functional_tests.rs
+++ b/lightning/src/ln/functional_tests.rs
@@ -272,7 +272,9 @@ pub fn test_duplicate_htlc_different_direction_onchain() {
// in opposite directions, even with the same payment secret.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_b_id = nodes[1].node.get_our_node_id();
@@ -399,7 +401,9 @@ pub fn test_duplicate_htlc_different_direction_onchain() {
pub fn test_inbound_outbound_capacity_is_not_zero() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let _ = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 95000000);
@@ -437,7 +441,12 @@ fn do_test_fail_back_before_backwards_timeout(post_fail_back_action: PostFailBac
// just before the upstream timeout expires
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
for node in nodes.iter() {
@@ -563,7 +572,18 @@ pub fn channel_monitor_network_test() {
// tests that ChannelMonitor is able to recover from various states.
let chanmon_cfgs = create_chanmon_cfgs(5);
let node_cfgs = create_node_cfgs(5, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(5, &node_cfgs, &[None, None, None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 5,
+ &node_cfgs,
+ &[
+ Some(legacy_cfg.clone()),
+ Some(legacy_cfg.clone()),
+ Some(legacy_cfg.clone()),
+ Some(legacy_cfg.clone()),
+ Some(legacy_cfg),
+ ],
+ );
let nodes = create_network(5, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -796,11 +816,11 @@ pub fn channel_monitor_network_test() {
#[xtest(feature = "_externalize_tests")]
pub fn test_justice_tx_htlc_timeout() {
// Test justice txn built on revoked HTLC-Timeout tx, against both sides
- let mut alice_config = test_default_channel_config();
+ let mut alice_config = test_legacy_channel_config();
alice_config.channel_handshake_config.announce_for_forwarding = true;
alice_config.channel_handshake_limits.force_announced_channel_preference = false;
alice_config.channel_handshake_config.our_to_self_delay = 6 * 24 * 5;
- let mut bob_config = test_default_channel_config();
+ let mut bob_config = test_legacy_channel_config();
bob_config.channel_handshake_config.announce_for_forwarding = true;
bob_config.channel_handshake_limits.force_announced_channel_preference = false;
bob_config.channel_handshake_config.our_to_self_delay = 6 * 24 * 3;
@@ -884,11 +904,11 @@ pub fn test_justice_tx_htlc_timeout() {
#[xtest(feature = "_externalize_tests")]
pub fn test_justice_tx_htlc_success() {
// Test justice txn built on revoked HTLC-Success tx, against both sides
- let mut alice_config = test_default_channel_config();
+ let mut alice_config = test_legacy_channel_config();
alice_config.channel_handshake_config.announce_for_forwarding = true;
alice_config.channel_handshake_limits.force_announced_channel_preference = false;
alice_config.channel_handshake_config.our_to_self_delay = 6 * 24 * 5;
- let mut bob_config = test_default_channel_config();
+ let mut bob_config = test_legacy_channel_config();
bob_config.channel_handshake_config.announce_for_forwarding = true;
bob_config.channel_handshake_limits.force_announced_channel_preference = false;
bob_config.channel_handshake_config.our_to_self_delay = 6 * 24 * 3;
@@ -961,7 +981,9 @@ pub fn revoked_output_claim() {
// transaction is broadcast by its counterparty
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -1012,7 +1034,9 @@ fn do_test_forming_justice_tx_from_monitor_updates(broadcast_initial_commitment:
WatchtowerPersister::new(destination_script1),
];
let node_cfgs = create_node_cfgs_with_persisters(2, &chanmon_cfgs, persisters.iter().collect());
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -1075,7 +1099,9 @@ pub fn claim_htlc_outputs() {
let mut chanmon_cfgs = create_chanmon_cfgs(2);
chanmon_cfgs[0].keys_manager.disable_revocation_policy_check = true;
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -1388,7 +1414,12 @@ pub fn test_htlc_on_chain_success() {
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -1635,7 +1666,12 @@ fn do_test_htlc_on_chain_timeout(connect_style: ConnectStyle) {
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -1886,7 +1922,12 @@ fn do_test_commitment_revoked_fail_backward_exhaustive(
// commitment_signed) we will be free to fail/fulfill the HTLC backwards.
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -2305,7 +2346,9 @@ pub fn test_htlc_ignore_latest_remote_commitment() {
// ignored if we cannot claim them. This originally tickled an invalid unwrap().
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -2357,7 +2400,12 @@ pub fn test_force_close_fail_back() {
// Check which HTLCs are failed-backwards on channel force-closure
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -3469,7 +3517,9 @@ pub fn test_claim_sizeable_push_msat() {
// Incidentally test SpendableOutput event generation due to detection of to_local output on commitment tx
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -3506,7 +3556,9 @@ pub fn test_claim_on_remote_sizeable_push_msat() {
// to_remote output is encumbered by a P2WPKH
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -3548,7 +3600,9 @@ pub fn test_claim_on_remote_revoked_sizeable_push_msat() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -3581,7 +3635,9 @@ pub fn test_claim_on_remote_revoked_sizeable_push_msat() {
pub fn test_static_spendable_outputs_preimage_tx() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -3631,7 +3687,9 @@ pub fn test_static_spendable_outputs_preimage_tx() {
pub fn test_static_spendable_outputs_timeout_tx() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -3742,7 +3800,9 @@ pub fn test_static_spendable_outputs_justice_tx_revoked_htlc_timeout_tx() {
let mut chanmon_cfgs = create_chanmon_cfgs(2);
chanmon_cfgs[0].keys_manager.disable_revocation_policy_check = true;
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -3821,7 +3881,9 @@ pub fn test_static_spendable_outputs_justice_tx_revoked_htlc_success_tx() {
let mut chanmon_cfgs = create_chanmon_cfgs(2);
chanmon_cfgs[1].keys_manager.disable_revocation_policy_check = true;
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -3908,7 +3970,12 @@ pub fn test_onchain_to_onchain_claim() {
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -4054,7 +4121,7 @@ pub fn test_duplicate_payment_hash_one_failure_one_success() {
let node_cfgs = create_node_cfgs(5, &chanmon_cfgs);
// When this test was written, the default base fee floated based on the HTLC count.
// It is now fixed, so we simply set the fee to the expected value here.
- let mut config = test_default_channel_config();
+ let mut config = test_legacy_channel_config();
config.channel_config.forwarding_fee_base_msat = 196;
let configs = [
@@ -4235,7 +4302,9 @@ pub fn test_duplicate_payment_hash_one_failure_one_success() {
pub fn test_dynamic_spendable_outputs_local_htlc_success_tx() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -4304,7 +4373,7 @@ fn do_test_fail_backwards_unrevoked_remote_announce(deliver_last_raa: bool, anno
let node_cfgs = create_node_cfgs(6, &chanmon_cfgs);
// When this test was written, the default base fee floated based on the HTLC count.
// It is now fixed, so we simply set the fee to the expected value here.
- let mut config = test_default_channel_config();
+ let mut config = test_legacy_channel_config();
config.channel_config.forwarding_fee_base_msat = 196;
let configs = [
@@ -4722,7 +4791,9 @@ pub fn test_fail_backwards_previous_remote_announce() {
pub fn test_dynamic_spendable_outputs_local_htlc_timeout_tx() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_b_id = nodes[1].node.get_our_node_id();
@@ -4815,7 +4886,12 @@ pub fn test_key_derivation_params() {
node_cfgs.remove(0);
node_cfgs.insert(0, node);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_b_id = nodes[1].node.get_our_node_id();
@@ -4932,7 +5008,9 @@ pub fn test_static_output_closing_tx() {
fn do_htlc_claim_local_commitment_only(use_dust: bool) {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -4976,7 +5054,9 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
fn do_htlc_claim_current_remote_commitment_only(use_dust: bool) {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_b_id = nodes[1].node.get_our_node_id();
@@ -5015,7 +5095,12 @@ fn do_htlc_claim_current_remote_commitment_only(use_dust: bool) {
fn do_htlc_claim_previous_remote_commitment_only(use_dust: bool, check_revoke_no_close: bool) {
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -5107,7 +5192,9 @@ pub fn htlc_claim_single_commitment_only_b() {
pub fn test_fail_holding_cell_htlc_upon_free() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -5206,7 +5293,9 @@ pub fn test_fail_holding_cell_htlc_upon_free() {
pub fn test_free_and_fail_holding_cell_htlcs() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -5349,7 +5438,7 @@ pub fn test_fail_holding_cell_htlc_upon_free_multihop() {
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
// Avoid having to include routing fees in calculations
- let mut config = test_default_channel_config();
+ let mut config = test_legacy_channel_config();
config.channel_config.forwarding_fee_base_msat = 0;
config.channel_config.forwarding_fee_proportional_millionths = 0;
let node_chanmgrs = create_node_chanmgrs(
@@ -5716,7 +5805,9 @@ fn do_test_failure_delay_dust_htlc_local_commitment(announce_latest: bool) {
let mut chanmon_cfgs = create_chanmon_cfgs(2);
chanmon_cfgs[0].keys_manager.disable_revocation_policy_check = true;
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -5824,7 +5915,12 @@ fn do_test_sweep_outbound_htlc_failure_update(revoked: bool, local: bool) {
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_b_id = nodes[1].node.get_our_node_id();
@@ -6130,7 +6226,9 @@ pub fn test_bump_penalty_txn_on_revoked_commitment() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -6237,7 +6335,9 @@ pub fn test_bump_penalty_txn_on_revoked_htlcs() {
let mut chanmon_cfgs = create_chanmon_cfgs(2);
chanmon_cfgs[1].keys_manager.disable_revocation_policy_check = true;
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -6439,7 +6539,9 @@ pub fn test_bump_penalty_txn_on_remote_commitment() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let remote_txn = {
@@ -7360,7 +7462,9 @@ pub fn test_concurrent_monitor_claim() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -7602,7 +7706,9 @@ pub fn test_htlc_no_detection() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_b_id = nodes[1].node.get_our_node_id();
@@ -7669,7 +7775,12 @@ fn do_test_onchain_htlc_settlement_after_close(
// 6) Bob claims the offered output on the broadcasted commitment.
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -7977,7 +8088,12 @@ pub fn test_error_chans_closed() {
// we can test various edge cases around it to ensure we don't regress.
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let node_b_id = nodes[1].node.get_our_node_id();
@@ -8076,7 +8192,12 @@ fn do_test_tx_confirmed_skipping_blocks_immediate_broadcast(test_height_before_t
// aren't broadcasting transactions too early (ie not broadcasting them at all).
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
*nodes[0].connect_style.borrow_mut() = ConnectStyle::BestBlockFirstSkippingBlocks;
@@ -8551,7 +8672,7 @@ fn do_test_max_dust_htlc_exposure(
// might be available again for HTLC processing once the dust bandwidth has cleared up.
let chanmon_cfgs = create_chanmon_cfgs(2);
- let mut config = test_default_channel_config();
+ let mut config = test_legacy_channel_config();
// We hard-code the feerate values here but they're re-calculated furter down and asserted.
// If the values ever change below these constants should simply be updated.
@@ -8937,7 +9058,7 @@ pub fn test_nondust_htlc_excess_fees_are_dust() {
}
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let mut config = test_default_channel_config();
+ let mut config = test_legacy_channel_config();
// Set the dust limit to the default value
config.channel_config.max_dust_htlc_exposure = MaxDustHTLCExposure::FeeRateMultiplier(10_000);
// Make sure the HTLC limits don't get in the way
@@ -9152,7 +9273,7 @@ fn do_test_nondust_htlc_fees_dust_exposure_delta(features: ChannelTypeFeatures)
assert_eq!(expected_dust_exposure_msat, 528_492);
}
- let mut default_config = test_default_channel_config();
+ let mut default_config = test_legacy_channel_config();
if features == ChannelTypeFeatures::anchors_zero_htlc_fee_and_dependencies() {
default_config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
// in addition to the one above, this setting is also needed to create an anchor channel
@@ -9685,7 +9806,7 @@ fn do_test_manual_broadcast_skips_commitment_until_funding(
// forced to broadcast using `ChannelMonitor::broadcast_latest_holder_commitment_txn`.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let mut chan_config = test_default_channel_config();
+ let mut chan_config = test_legacy_channel_config();
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, Some(chan_config)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -9913,7 +10034,7 @@ pub fn test_dust_exposure_holding_cell_assertion() {
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
// Configure nodes with specific dust limits
- let mut config = test_default_channel_config();
+ let mut config = test_legacy_channel_config();
// Use a fixed dust exposure limit to make the test simpler
const DUST_HTLC_VALUE_MSAT: u64 = 500_000;
config.channel_config.max_dust_htlc_exposure = MaxDustHTLCExposure::FixedLimitMsat(5_000_000);
diff --git a/lightning/src/ln/htlc_reserve_unit_tests.rs b/lightning/src/ln/htlc_reserve_unit_tests.rs
index e719f5e..5b2ffca 100644
--- a/lightning/src/ln/htlc_reserve_unit_tests.rs
+++ b/lightning/src/ln/htlc_reserve_unit_tests.rs
@@ -33,7 +33,9 @@ fn do_test_counterparty_no_reserve(send_from_initiator: bool) {
// in normal testing, we test it explicitly here.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -121,7 +123,7 @@ pub fn test_channel_reserve_holding_cell_htlcs() {
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
// When this test was written, the default base fee floated based on the HTLC count.
// It is now fixed, so we simply set the fee to the expected value here.
- let mut config = test_default_channel_config();
+ let mut config = test_legacy_channel_config();
config.channel_config.forwarding_fee_base_msat = 239;
let configs = [Some(config.clone()), Some(config.clone()), Some(config.clone())];
@@ -749,7 +751,9 @@ pub fn holding_cell_htlc_counting() {
pub fn test_basic_channel_reserve() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 95000000);
@@ -778,7 +782,8 @@ pub fn test_basic_channel_reserve() {
#[xtest(feature = "_externalize_tests")]
fn test_fee_spike_violation_fails_htlc() {
- do_test_fee_spike_buffer(None, true)
+ let cfg = test_legacy_channel_config();
+ do_test_fee_spike_buffer(Some(cfg), true)
}
#[test]
@@ -987,7 +992,9 @@ pub fn test_chan_reserve_violation_outbound_htlc_inbound_chan() {
// this situation.
let feerate_per_kw = *chanmon_cfgs[0].fee_estimator.sat_per_kw.lock().unwrap();
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let default_config = UserConfig::default();
@@ -1025,7 +1032,9 @@ pub fn test_chan_reserve_violation_inbound_htlc_outbound_channel() {
let mut chanmon_cfgs = create_chanmon_cfgs(2);
let feerate_per_kw = *chanmon_cfgs[0].fee_estimator.sat_per_kw.lock().unwrap();
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_b_id = nodes[1].node.get_our_node_id();
@@ -1104,7 +1113,9 @@ pub fn test_chan_reserve_dust_inbound_htlcs_outbound_chan() {
let feerate_per_kw = *chanmon_cfgs[0].fee_estimator.sat_per_kw.lock().unwrap();
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let default_config = UserConfig::default();
@@ -1153,7 +1164,9 @@ pub fn test_chan_reserve_dust_inbound_htlcs_inbound_chan() {
// calculating our counterparty's commitment transaction fee (this was previously broken).
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 98000000);
@@ -1565,7 +1578,9 @@ pub fn test_update_add_htlc_bolt2_receiver_sender_can_afford_amount_sent() {
//BOLT2 Requirement: receiving an amount_msat that the sending node cannot afford at the current feerate_per_kw (while maintaining its channel reserve): SHOULD fail the channel
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -2141,12 +2156,8 @@ pub fn do_test_dust_limit_fee_accounting(can_afford: bool) {
let chanmon_cfgs = create_chanmon_cfgs(2);
- let mut default_config = test_default_channel_config();
- default_config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
-
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs =
- create_node_chanmgrs(2, &node_cfgs, &[Some(default_config.clone()), Some(default_config)]);
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
diff --git a/lightning/src/ln/invoice_utils.rs b/lightning/src/ln/invoice_utils.rs
index 3eaa369..1503a9a 100644
--- a/lightning/src/ln/invoice_utils.rs
+++ b/lightning/src/ln/invoice_utils.rs
@@ -1125,7 +1125,8 @@ mod test {
fn test_channels_with_lower_inbound_capacity_than_invoice_amt_hints_filtering() {
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[Some(legacy_cfg), None, None]);
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let chan_1_0 = create_unannounced_chan_between_nodes_with_value(&nodes, 1, 0, 100_000, 0);
let chan_2_0 = create_unannounced_chan_between_nodes_with_value(&nodes, 2, 0, 1_000_000, 0);
@@ -1731,7 +1732,9 @@ mod test {
chanmon_cfgs[1].keys_manager.backing = make_dyn_keys_interface(&seed_1);
chanmon_cfgs[2].keys_manager.backing = make_dyn_keys_interface(&seed_2);
let node_cfgs = create_node_cfgs(4, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(4, &node_cfgs, &[None, None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(4, &node_cfgs, &[Some(legacy_cfg), None, None, None]);
let nodes = create_network(4, &node_cfgs, &node_chanmgrs);
let chan_0_2 = create_unannounced_chan_between_nodes_with_value(&nodes, 0, 2, 1_000_000, 0);
diff --git a/lightning/src/ln/monitor_tests.rs b/lightning/src/ln/monitor_tests.rs
index 8074f71..cdbd6e6 100644
--- a/lightning/src/ln/monitor_tests.rs
+++ b/lightning/src/ln/monitor_tests.rs
@@ -175,7 +175,7 @@ fn archive_fully_resolved_monitors() {
// Test we archive fully resolved channel monitors at the right time.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let mut user_config = test_default_channel_config();
+ let mut user_config = test_legacy_channel_config();
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(user_config.clone()), Some(user_config)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -1121,7 +1121,8 @@ fn test_no_preimage_inbound_htlc_balances() {
// have a preimage.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let (_, _, chan_id, funding_tx) = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 500_000_000);
@@ -2317,7 +2318,8 @@ fn do_test_restored_packages_retry(check_old_monitor_retries_after_upgrade: bool
let persister;
let new_chain_monitor;
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let node_deserialized;
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -3830,7 +3832,8 @@ fn test_ladder_preimage_htlc_claims() {
// already claimed) resulting in an invalid claim transaction.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_id_0 = nodes[0].node.get_our_node_id();
diff --git a/lightning/src/ln/payment_tests.rs b/lightning/src/ln/payment_tests.rs
index e24ad48..40fbae5 100644
--- a/lightning/src/ln/payment_tests.rs
+++ b/lightning/src/ln/payment_tests.rs
@@ -212,7 +212,7 @@ fn mpp_retry_overpay() {
let chanmon_cfgs = create_chanmon_cfgs(4);
let node_cfgs = create_node_cfgs(4, &chanmon_cfgs);
- let mut user_config = test_default_channel_config();
+ let mut user_config = test_legacy_channel_config();
user_config.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel = 100;
let mut limited_1 = user_config.clone();
limited_1.channel_handshake_config.our_htlc_minimum_msat = 35_000_000;
@@ -782,7 +782,12 @@ fn do_retry_with_no_persist(confirm_before_reload: bool) {
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let persister;
let new_chain_monitor;
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 3,
+ &node_cfgs,
+ &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)],
+ );
let node_a_reload;
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
@@ -1019,7 +1024,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let mut manually_accept_config = test_default_channel_config();
+ let mut legacy_cfg = test_legacy_channel_config();
let persist_1;
let chain_monitor_1;
@@ -1028,8 +1033,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
let persist_3;
let chain_monitor_3;
- let node_chanmgrs =
- create_node_chanmgrs(3, &node_cfgs, &[None, Some(manually_accept_config), None]);
+ let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, Some(legacy_cfg), None]);
let node_a_1;
let node_a_2;
let node_a_3;
@@ -1254,7 +1258,9 @@ fn do_test_dup_htlc_onchain_doesnt_fail_on_reload(
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let persister;
let chain_monitor;
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let node_a_reload;
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -2867,7 +2873,9 @@ fn auto_retry_partial_failure() {
// Test that we'll retry appropriately on send partial failure and retry partial failure.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -3112,7 +3120,9 @@ fn auto_retry_partial_failure() {
fn auto_retry_zero_attempts_send_error() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_b_id = nodes[1].node.get_our_node_id();
@@ -4108,7 +4118,9 @@ fn do_no_missing_sent_on_reload(persist_manager_with_payment: bool, at_midpoint:
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let (persist_a, persist_b, persist_c);
let (chain_monitor_a, chain_monitor_b, chain_monitor_c);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let (node_a_1, node_a_2, node_a_3);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -4249,7 +4261,17 @@ fn do_claim_from_closed_chan(fail_payment: bool) {
// CLTVs on the paths to different value resulting in a different claim deadline.
let chanmon_cfgs = create_chanmon_cfgs(4);
let node_cfgs = create_node_cfgs(4, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(4, &node_cfgs, &[None, None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(
+ 4,
+ &node_cfgs,
+ &[
+ Some(legacy_cfg.clone()),
+ Some(legacy_cfg.clone()),
+ Some(legacy_cfg.clone()),
+ Some(legacy_cfg),
+ ],
+ );
let mut nodes = create_network(4, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -5139,7 +5161,7 @@ fn test_non_strict_forwarding() {
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let mut config = test_default_channel_config();
+ let mut config = test_legacy_channel_config();
config.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel = 100;
let configs = [Some(config.clone()), Some(config.clone()), Some(config)];
diff --git a/lightning/src/ln/reload_tests.rs b/lightning/src/ln/reload_tests.rs
index 7c66d75..45e4549 100644
--- a/lightning/src/ln/reload_tests.rs
+++ b/lightning/src/ln/reload_tests.rs
@@ -368,7 +368,8 @@ fn test_manager_serialize_deserialize_inconsistent_monitor() {
let persister;
let new_chain_monitor;
- let node_chanmgrs = create_node_chanmgrs(4, &node_cfgs, &[None, None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(4, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes_0_deserialized;
let mut nodes = create_network(4, &node_cfgs, &node_chanmgrs);
@@ -523,7 +524,8 @@ fn do_test_data_loss_protect(reconnect_panicing: bool, substantially_old: bool,
let persister;
let new_chain_monitor;
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes_0_deserialized;
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -931,7 +933,7 @@ fn do_forwarded_payment_no_manager_persistence(use_cs_commitment: bool, claim_ht
let persister;
let new_chain_monitor;
- let mut intercept_forwards_config = test_default_channel_config();
+ let mut intercept_forwards_config = test_legacy_channel_config();
intercept_forwards_config.htlc_interception_flags =
HTLCInterceptionFlags::ToInterceptSCIDs as u8;
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, Some(intercept_forwards_config), None]);
@@ -1109,7 +1111,8 @@ fn removed_payment_no_manager_persistence() {
let persister;
let new_chain_monitor;
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes_1_deserialized;
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
@@ -1326,7 +1329,8 @@ fn test_reload_partial_funding_batch() {
let new_persister;
let new_chain_monitor;
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let new_channel_manager;
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
@@ -1461,7 +1465,8 @@ fn test_peer_storage() {
let (persister, chain_monitor);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let nodes_0_deserialized;
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -1512,7 +1517,7 @@ fn test_peer_storage() {
// TODO: Handle the case where we've completely forgotten about an active channel.
reload_node!(
nodes[0],
- test_default_channel_config(),
+ test_legacy_channel_config(),
&nodes_0_serialized,
&[&old_state_monitor[..]],
persister,
diff --git a/lightning/src/ln/reorg_tests.rs b/lightning/src/ln/reorg_tests.rs
index 4c1bdd7..1a4dab9 100644
--- a/lightning/src/ln/reorg_tests.rs
+++ b/lightning/src/ln/reorg_tests.rs
@@ -49,7 +49,8 @@ fn do_test_onchain_htlc_reorg(local_commitment: bool, claim: bool) {
// before they otherwise would and reorg them out, confirming an HTLC-Success tx instead.
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, Some(legacy_cfg), None]);
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
create_announced_chan_between_nodes(&nodes, 0, 1);
@@ -182,7 +183,8 @@ fn test_counterparty_revoked_reorg() {
// still be claim-from-able after the reorg.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg), None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 500_000_000);
@@ -255,7 +257,8 @@ fn do_test_unconf_chan(reload_node: bool, reorg_after_reload: bool, use_funding_
let persister;
let new_chain_monitor;
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg), None]);
let nodes_0_deserialized;
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -466,7 +469,8 @@ fn test_set_outpoints_partial_claiming() {
// - disconnect tx, see no tx anymore
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg), None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1000000, 59000000);
@@ -681,7 +685,8 @@ fn test_htlc_preimage_claim_holder_commitment_after_counterparty_commitment_reor
// test that we only claim the currently confirmed commitment.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg), None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let (_, _, chan_id, funding_tx) = create_announced_chan_between_nodes(&nodes, 0, 1);
@@ -756,7 +761,8 @@ fn test_htlc_preimage_claim_prev_counterparty_commitment_after_current_counterpa
// confirmed commitment.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg), None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let (_, _, chan_id, funding_tx) = create_announced_chan_between_nodes(&nodes, 0, 1);
diff --git a/lightning/src/ln/shutdown_tests.rs b/lightning/src/ln/shutdown_tests.rs
index 74ffe3c..d24a4d8 100644
--- a/lightning/src/ln/shutdown_tests.rs
+++ b/lightning/src/ln/shutdown_tests.rs
@@ -1335,7 +1335,8 @@ fn do_test_closing_signed_reinit_timeout(timeout_step: TimeoutStep) {
// it manually.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg), None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
let node_b_id = nodes[1].node.get_our_node_id();
diff --git a/lightning/src/ln/splicing_tests.rs b/lightning/src/ln/splicing_tests.rs
index 618271d..0875479 100644
--- a/lightning/src/ln/splicing_tests.rs
+++ b/lightning/src/ln/splicing_tests.rs
@@ -1066,7 +1066,7 @@ fn do_test_splice_commitment_broadcast(splice_status: SpliceStatus, claim_htlcs:
// Tests that we're able to enforce HTLCs onchain during the different stages of a splice.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let config = test_default_anchors_channel_config();
+ let config = test_default_channel_config();
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(config.clone()), Some(config)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -1818,7 +1818,7 @@ fn do_test_propose_splice_while_disconnected(reload: bool, use_0conf: bool) {
fn disconnect_on_unexpected_interactive_tx_message() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let config = test_default_anchors_channel_config();
+ let config = test_default_channel_config();
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(config.clone()), Some(config)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -1857,7 +1857,7 @@ fn disconnect_on_unexpected_interactive_tx_message() {
fn fail_splice_on_interactive_tx_error() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let config = test_default_anchors_channel_config();
+ let config = test_default_channel_config();
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(config.clone()), Some(config)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -1911,7 +1911,7 @@ fn fail_splice_on_interactive_tx_error() {
fn fail_splice_on_tx_abort() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let config = test_default_anchors_channel_config();
+ let config = test_default_channel_config();
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(config.clone()), Some(config)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -1965,7 +1965,7 @@ fn fail_splice_on_tx_abort() {
fn fail_splice_on_channel_close() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let config = test_default_anchors_channel_config();
+ let config = test_default_channel_config();
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(config.clone()), Some(config)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -2016,7 +2016,7 @@ fn fail_splice_on_channel_close() {
fn fail_quiescent_action_on_channel_close() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let config = test_default_anchors_channel_config();
+ let config = test_default_channel_config();
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(config.clone()), Some(config)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
diff --git a/lightning/src/ln/update_fee_tests.rs b/lightning/src/ln/update_fee_tests.rs
index 69890fb..24ae852 100644
--- a/lightning/src/ln/update_fee_tests.rs
+++ b/lightning/src/ln/update_fee_tests.rs
@@ -385,16 +385,13 @@ pub fn do_test_update_fee_that_funder_cannot_afford(channel_type_features: Chann
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let mut default_config = test_default_channel_config();
+ let mut cfg = test_legacy_channel_config();
if channel_type_features == ChannelTypeFeatures::anchors_zero_htlc_fee_and_dependencies() {
- default_config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
+ cfg.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
}
- let node_chanmgrs = create_node_chanmgrs(
- 2,
- &node_cfgs,
- &[Some(default_config.clone()), Some(default_config.clone())],
- );
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(cfg.clone()), Some(cfg.clone())]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -411,8 +408,7 @@ pub fn do_test_update_fee_that_funder_cannot_afford(channel_type_features: Chann
);
let channel_id = chan.2;
let secp_ctx = Secp256k1::new();
- let bs_channel_reserve_sats =
- get_holder_selected_channel_reserve_satoshis(channel_value, &default_config);
+ let bs_channel_reserve_sats = get_holder_selected_channel_reserve_satoshis(channel_value, &cfg);
let (anchor_outputs_value_sats, outputs_num_no_htlcs) =
if channel_type_features.supports_anchors_zero_fee_htlc_tx() {
(ANCHOR_OUTPUT_VALUE_SATOSHI * 2, 4)
@@ -546,13 +542,12 @@ pub fn test_update_fee_that_saturates_subs() {
// on the commitment transaction that is greater than her balance, we saturate the subtractions,
// and force close the channel.
- let mut default_config = test_default_channel_config();
+ let mut cfg = test_legacy_channel_config();
let secp_ctx = Secp256k1::new();
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs =
- create_node_chanmgrs(2, &node_cfgs, &[Some(default_config.clone()), Some(default_config)]);
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(cfg.clone()), Some(cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -868,7 +863,9 @@ pub fn test_chan_init_feerate_unaffordability() {
let mut chanmon_cfgs = create_chanmon_cfgs(2);
let feerate_per_kw = *chanmon_cfgs[0].fee_estimator.sat_per_kw.lock().unwrap();
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_a_id = nodes[0].node.get_our_node_id();
@@ -1033,16 +1030,14 @@ pub fn do_cannot_afford_on_holding_cell_release(
// update_fee from its holding cell, we do not generate any msg events
let chanmon_cfgs = create_chanmon_cfgs(2);
- let mut default_config = test_default_channel_config();
- default_config.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel =
- 100;
+ let mut cfg = test_legacy_channel_config();
+ cfg.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel = 100;
if channel_type_features.supports_anchors_zero_fee_htlc_tx() {
- default_config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
+ cfg.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx = true;
}
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
- let node_chanmgrs =
- create_node_chanmgrs(2, &node_cfgs, &[Some(default_config.clone()), Some(default_config)]);
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[Some(cfg.clone()), Some(cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
@@ -1219,13 +1214,12 @@ pub fn do_can_afford_given_trimmed_htlcs(inequality_regions: core::cmp::Ordering
let chanmon_cfgs = create_chanmon_cfgs(2);
- let mut default_config = test_default_channel_config();
- default_config.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel =
- 100;
+ let mut legacy_cfg = test_legacy_channel_config();
+ legacy_cfg.channel_handshake_config.max_inbound_htlc_value_in_flight_percent_of_channel = 100;
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs =
- create_node_chanmgrs(2, &node_cfgs, &[Some(default_config.clone()), Some(default_config)]);
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
diff --git a/lightning/src/util/persist.rs b/lightning/src/util/persist.rs
index 1b750c6..cb4bdeb 100644
--- a/lightning/src/util/persist.rs
+++ b/lightning/src/util/persist.rs
@@ -1657,7 +1657,9 @@ mod tests {
);
node_cfgs[0].chain_monitor = chain_mon_0;
node_cfgs[1].chain_monitor = chain_mon_1;
- let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let legacy_cfg = test_legacy_channel_config();
+ let node_chanmgrs =
+ create_node_chanmgrs(2, &node_cfgs, &[Some(legacy_cfg.clone()), Some(legacy_cfg)]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
// Check that the persisted channel data is empty before any channels are
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.