Skip to content

Commit 5b6b691

Browse files
authored
Merge pull request #4038 from TheBlueMatt/2025-08-change-config
Allow changing ChannelManager::default_configuration at runtime
2 parents 26639f1 + 72fa184 commit 5b6b691

File tree

7 files changed

+98
-60
lines changed

7 files changed

+98
-60
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
771771
router: &router,
772772
message_router: &router,
773773
logger,
774-
default_config: config,
774+
config,
775775
channel_monitors: monitor_refs,
776776
};
777777

lightning/src/ln/channelmanager.rs

Lines changed: 87 additions & 49 deletions
Large diffs are not rendered by default.

lightning/src/ln/dual_funding_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn do_test_v2_channel_establishment(session: V2ChannelEstablishmentTestSession)
6262
funding_satoshis,
6363
initiator_funding_inputs.clone(),
6464
42, /* user_channel_id */
65-
nodes[0].node.get_current_default_configuration(),
65+
&nodes[0].node.get_current_config(),
6666
nodes[0].best_block_info().1,
6767
nodes[0].node.create_and_insert_outbound_scid_alias_for_test(),
6868
ConfirmationTarget::NonAnchorChannelFee,

lightning/src/ln/functional_test_utils.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
866866
)>::read(
867867
&mut io::Cursor::new(w.0),
868868
ChannelManagerReadArgs {
869-
default_config: self.node.get_current_default_configuration().clone(),
869+
config: self.node.get_current_config(),
870870
entropy_source: self.keys_manager,
871871
node_signer: self.keys_manager,
872872
signer_provider: self.keys_manager,
@@ -1279,7 +1279,7 @@ fn check_claimed_htlcs_match_route<'a, 'b, 'c>(
12791279
}
12801280

12811281
pub fn _reload_node<'a, 'b, 'c>(
1282-
node: &'a Node<'a, 'b, 'c>, default_config: UserConfig, chanman_encoded: &[u8],
1282+
node: &'a Node<'a, 'b, 'c>, config: UserConfig, chanman_encoded: &[u8],
12831283
monitors_encoded: &[&[u8]],
12841284
) -> TestChannelManager<'b, 'c> {
12851285
let mut monitors_read = Vec::with_capacity(monitors_encoded.len());
@@ -1303,7 +1303,7 @@ pub fn _reload_node<'a, 'b, 'c>(
13031303
<(BlockHash, TestChannelManager<'b, 'c>)>::read(
13041304
&mut node_read,
13051305
ChannelManagerReadArgs {
1306-
default_config,
1306+
config,
13071307
entropy_source: node.keys_manager,
13081308
node_signer: node.keys_manager,
13091309
signer_provider: node.keys_manager,
@@ -1651,7 +1651,7 @@ pub fn exchange_open_accept_chan<'a, 'b, 'c>(
16511651
42
16521652
);
16531653
node_b.node.handle_open_channel(node_a_id, &open_channel_msg);
1654-
if node_b.node.get_current_default_configuration().manually_accept_inbound_channels {
1654+
if node_b.node.get_current_config().manually_accept_inbound_channels {
16551655
let events = node_b.node.get_and_clear_pending_events();
16561656
assert_eq!(events.len(), 1);
16571657
match &events[0] {
@@ -1830,7 +1830,7 @@ pub fn create_unannounced_chan_between_nodes_with_value<'a, 'b, 'c, 'd>(
18301830
let node_a_id = nodes[a].node.get_our_node_id();
18311831
let node_b_id = nodes[b].node.get_our_node_id();
18321832

1833-
let mut no_announce_cfg = nodes[a].node.get_current_default_configuration().clone();
1833+
let mut no_announce_cfg = nodes[a].node.get_current_config();
18341834
no_announce_cfg.channel_handshake_config.announce_for_forwarding = false;
18351835
nodes[a]
18361836
.node

lightning/src/ln/onion_route_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ fn do_test_onion_failure_stale_channel_update(announce_for_forwarding: bool) {
17761776
let chan_2_monitor_serialized = get_monitor!(nodes[1], channel_to_update.0).encode();
17771777
reload_node!(
17781778
nodes[1],
1779-
nodes[1].node.get_current_default_configuration().clone(),
1779+
nodes[1].node.get_current_config(),
17801780
&nodes[1].node.encode(),
17811781
&[&chan_1_monitor_serialized, &chan_2_monitor_serialized],
17821782
persister,

lightning/src/ln/reload_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ fn test_manager_serialize_deserialize_inconsistent_monitor() {
426426
let mut nodes_0_read = &nodes_0_serialized[..];
427427
if let Err(msgs::DecodeError::DangerousValue) =
428428
<(BlockHash, ChannelManager<&test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestRouter, &test_utils::TestMessageRouter, &test_utils::TestLogger>)>::read(&mut nodes_0_read, ChannelManagerReadArgs {
429-
default_config: UserConfig::default(),
429+
config: UserConfig::default(),
430430
entropy_source: keys_manager,
431431
node_signer: keys_manager,
432432
signer_provider: keys_manager,
@@ -444,7 +444,7 @@ fn test_manager_serialize_deserialize_inconsistent_monitor() {
444444
let mut nodes_0_read = &nodes_0_serialized[..];
445445
let (_, nodes_0_deserialized_tmp) =
446446
<(BlockHash, ChannelManager<&test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestRouter, &test_utils::TestMessageRouter, &test_utils::TestLogger>)>::read(&mut nodes_0_read, ChannelManagerReadArgs {
447-
default_config: UserConfig::default(),
447+
config: UserConfig::default(),
448448
entropy_source: keys_manager,
449449
node_signer: keys_manager,
450450
signer_provider: keys_manager,

lightning/src/ln/reorg_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ fn do_test_unconf_chan(reload_node: bool, reorg_after_reload: bool, use_funding_
323323
let nodes_0_serialized = nodes[0].node.encode();
324324
let chan_0_monitor_serialized = get_monitor!(nodes[0], chan.2).encode();
325325

326-
reload_node!(nodes[0], nodes[0].node.get_current_default_configuration().clone(), &nodes_0_serialized, &[&chan_0_monitor_serialized], persister, new_chain_monitor, nodes_0_deserialized);
326+
reload_node!(nodes[0], nodes[0].node.get_current_config(), &nodes_0_serialized, &[&chan_0_monitor_serialized], persister, new_chain_monitor, nodes_0_deserialized);
327327
}
328328

329329
if reorg_after_reload {

0 commit comments

Comments
 (0)