Skip to content

Commit 9f18026

Browse files
committed
Rename UserConfig and LegacyChannelConfig fields
The current names aren't very clear to what each field represents, this commit aims to improve that.
1 parent 4356809 commit 9f18026

11 files changed

+152
-152
lines changed

lightning-invoice/src/utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ mod test {
659659
// `msgs::ChannelUpdate` is never handled for the node(s). As the `msgs::ChannelUpdate`
660660
// is never handled, the `channel.counterparty.forwarding_info` is never assigned.
661661
let mut private_chan_cfg = UserConfig::default();
662-
private_chan_cfg.own_channel_config.announced_channel = false;
662+
private_chan_cfg.channel_handshake_config.announced_channel = false;
663663
let temporary_channel_id = nodes[2].node.create_channel(nodes[0].node.get_our_node_id(), 1_000_000, 500_000_000, 42, Some(private_chan_cfg)).unwrap();
664664
let open_channel = get_event_msg!(nodes[2], MessageSendEvent::SendOpenChannel, nodes[0].node.get_our_node_id());
665665
nodes[0].node.handle_open_channel(&nodes[2].node.get_our_node_id(), InitFeatures::known(), &open_channel);
@@ -1046,7 +1046,7 @@ mod test {
10461046
// `msgs::ChannelUpdate` is never handled for the node(s). As the `msgs::ChannelUpdate`
10471047
// is never handled, the `channel.counterparty.forwarding_info` is never assigned.
10481048
let mut private_chan_cfg = UserConfig::default();
1049-
private_chan_cfg.own_channel_config.announced_channel = false;
1049+
private_chan_cfg.channel_handshake_config.announced_channel = false;
10501050
let temporary_channel_id = nodes[1].node.create_channel(nodes[3].node.get_our_node_id(), 1_000_000, 500_000_000, 42, Some(private_chan_cfg)).unwrap();
10511051
let open_channel = get_event_msg!(nodes[1], MessageSendEvent::SendOpenChannel, nodes[3].node.get_our_node_id());
10521052
nodes[3].node.handle_open_channel(&nodes[1].node.get_our_node_id(), InitFeatures::known(), &open_channel);

lightning/src/ln/chanmon_update_fail_tests.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2541,7 +2541,7 @@ fn test_temporary_error_during_shutdown() {
25412541
// Test that temporary failures when updating the monitor's shutdown script delay cooperative
25422542
// close.
25432543
let mut config = test_default_channel_config();
2544-
config.own_channel_config.commit_upfront_shutdown_pubkey = false;
2544+
config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
25452545

25462546
let chanmon_cfgs = create_chanmon_cfgs(2);
25472547
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
@@ -2596,7 +2596,7 @@ fn test_permanent_error_during_sending_shutdown() {
25962596
// Test that permanent failures when updating the monitor's shutdown script result in a force
25972597
// close when initiating a cooperative close.
25982598
let mut config = test_default_channel_config();
2599-
config.own_channel_config.commit_upfront_shutdown_pubkey = false;
2599+
config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
26002600

26012601
let chanmon_cfgs = create_chanmon_cfgs(2);
26022602
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
@@ -2617,7 +2617,7 @@ fn test_permanent_error_during_handling_shutdown() {
26172617
// Test that permanent failures when updating the monitor's shutdown script result in a force
26182618
// close when handling a cooperative close.
26192619
let mut config = test_default_channel_config();
2620-
config.own_channel_config.commit_upfront_shutdown_pubkey = false;
2620+
config.channel_handshake_config.commit_upfront_shutdown_pubkey = false;
26212621

26222622
let chanmon_cfgs = create_chanmon_cfgs(2);
26232623
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);

lightning/src/ln/channel.rs

+49-49
Large diffs are not rendered by default.

lightning/src/ln/channelmanager.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4346,7 +4346,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
43464346
if chan.get().get_counterparty_node_id() != *counterparty_node_id {
43474347
return Err(MsgHandleErrInternal::send_err_msg_no_close("Got a message for a channel from the wrong node!".to_owned(), msg.temporary_channel_id));
43484348
}
4349-
try_chan_entry!(self, chan.get_mut().accept_channel(&msg, &self.default_configuration.peer_channel_config_limits, &their_features), channel_state, chan);
4349+
try_chan_entry!(self, chan.get_mut().accept_channel(&msg, &self.default_configuration.channel_handshake_limits, &their_features), channel_state, chan);
43504350
(chan.get().get_value_satoshis(), chan.get().get_funding_redeemscript().to_v0_p2wsh(), chan.get().get_user_id())
43514351
},
43524352
hash_map::Entry::Vacant(_) => return Err(MsgHandleErrInternal::send_err_msg_no_close("Failed to find corresponding channel".to_owned(), msg.temporary_channel_id))

lightning/src/ln/functional_test_utils.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ pub fn create_announced_chan_between_nodes_with_value<'a, 'b, 'c, 'd>(nodes: &'a
772772

773773
pub fn create_unannounced_chan_between_nodes_with_value<'a, 'b, 'c, 'd>(nodes: &'a Vec<Node<'b, 'c, 'd>>, a: usize, b: usize, channel_value: u64, push_msat: u64, a_flags: InitFeatures, b_flags: InitFeatures) -> (msgs::ChannelReady, Transaction) {
774774
let mut no_announce_cfg = test_default_channel_config();
775-
no_announce_cfg.own_channel_config.announced_channel = false;
775+
no_announce_cfg.channel_handshake_config.announced_channel = false;
776776
nodes[a].node.create_channel(nodes[b].node.get_our_node_id(), channel_value, push_msat, 42, Some(no_announce_cfg)).unwrap();
777777
let open_channel = get_event_msg!(nodes[a], MessageSendEvent::SendOpenChannel, nodes[b].node.get_our_node_id());
778778
nodes[b].node.handle_open_channel(&nodes[a].node.get_our_node_id(), a_flags, &open_channel);
@@ -1691,7 +1691,7 @@ pub fn do_claim_payment_along_route<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>,
16911691
$node.node.handle_update_fulfill_htlc(&$prev_node.node.get_our_node_id(), &next_msgs.as_ref().unwrap().0);
16921692
let fee = $node.node.channel_state.lock().unwrap()
16931693
.by_id.get(&next_msgs.as_ref().unwrap().0.channel_id).unwrap()
1694-
.config.mutable.forwarding_fee_base_msat;
1694+
.config.options.forwarding_fee_base_msat;
16951695
expect_payment_forwarded!($node, $next_node, $prev_node, Some(fee as u64), false, false);
16961696
expected_total_fee_msat += fee as u64;
16971697
check_added_monitors!($node, 1);
@@ -1967,15 +1967,15 @@ pub fn test_default_channel_config() -> UserConfig {
19671967
let mut default_config = UserConfig::default();
19681968
// Set cltv_expiry_delta slightly lower to keep the final CLTV values inside one byte in our
19691969
// tests so that our script-length checks don't fail (see ACCEPTED_HTLC_SCRIPT_WEIGHT).
1970-
default_config.channel_options.cltv_expiry_delta = MIN_CLTV_EXPIRY_DELTA;
1971-
default_config.own_channel_config.announced_channel = true;
1972-
default_config.peer_channel_config_limits.force_announced_channel_preference = false;
1970+
default_config.channel_config.cltv_expiry_delta = MIN_CLTV_EXPIRY_DELTA;
1971+
default_config.channel_handshake_config.announced_channel = true;
1972+
default_config.channel_handshake_limits.force_announced_channel_preference = false;
19731973
// When most of our tests were written, the default HTLC minimum was fixed at 1000.
19741974
// It now defaults to 1, so we simply set it to the expected value here.
1975-
default_config.own_channel_config.our_htlc_minimum_msat = 1000;
1975+
default_config.channel_handshake_config.our_htlc_minimum_msat = 1000;
19761976
// When most of our tests were written, we didn't have the notion of a `max_dust_htlc_exposure_msat`,
19771977
// It now defaults to 5_000_000 msat; to avoid interfering with tests we bump it to 50_000_000 msat.
1978-
default_config.channel_options.max_dust_htlc_exposure_msat = 50_000_000;
1978+
default_config.channel_config.max_dust_htlc_exposure_msat = 50_000_000;
19791979
default_config
19801980
}
19811981

0 commit comments

Comments
 (0)