Skip to content

Commit 4aa27b4

Browse files
committed
Expose ChannelManager's current config and use it in reload in tests
1 parent c5433aa commit 4aa27b4

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,11 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
850850
}
851851
}
852852

853+
/// Gets the current configuration applied to all new channels, as
854+
pub fn get_current_default_configuration(&self) -> &UserConfig {
855+
&self.default_configuration
856+
}
857+
853858
/// Creates a new outbound channel to the given remote node and with the given value.
854859
///
855860
/// user_id will be provided back as user_channel_id in FundingGenerationReady and

lightning/src/ln/functional_test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
281281
let mut w = test_utils::TestVecWriter(Vec::new());
282282
self.node.write(&mut w).unwrap();
283283
<(BlockHash, ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>)>::read(&mut ::std::io::Cursor::new(w.0), ChannelManagerReadArgs {
284-
default_config: UserConfig::default(),
284+
default_config: *self.node.get_current_default_configuration(),
285285
keys_manager: self.keys_manager,
286286
fee_estimator: &test_utils::TestFeeEstimator { sat_per_kw: 253 },
287287
chain_monitor: self.chain_monitor,

lightning/src/ln/reorg_tests.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use chain::Watch;
1414
use ln::channelmanager::{ChannelManager, ChannelManagerReadArgs};
1515
use ln::features::InitFeatures;
1616
use ln::msgs::{ChannelMessageHandler, ErrorAction, HTLCFailChannelUpdate};
17-
use util::config::UserConfig;
1817
use util::enforcing_trait_impls::EnforcingSigner;
1918
use util::events::{Event, EventsProvider, MessageSendEvent, MessageSendEventsProvider};
2019
use util::test_utils;
@@ -233,14 +232,13 @@ fn do_test_unconf_chan(reload_node: bool, reorg_after_reload: bool, connect_styl
233232
assert!(chan_0_monitor_read.is_empty());
234233

235234
let mut nodes_0_read = &nodes_0_serialized[..];
236-
let config = UserConfig::default();
237235
nodes_0_deserialized = {
238236
let mut channel_monitors = HashMap::new();
239237
channel_monitors.insert(chan_0_monitor.get_funding_txo().0, &mut chan_0_monitor);
240238
<(BlockHash, ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster,
241239
&test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>)>::read(
242240
&mut nodes_0_read, ChannelManagerReadArgs {
243-
default_config: config,
241+
default_config: *nodes[0].node.get_current_default_configuration(),
244242
keys_manager,
245243
fee_estimator: node_cfgs[0].fee_estimator,
246244
chain_monitor: nodes[0].chain_monitor,

0 commit comments

Comments
 (0)