mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-24 23:08:36 +01:00
Expose ChannelManager's current config and use it in reload in tests
This commit is contained in:
parent
bdbba5e98f
commit
46ac4c796a
3 changed files with 8 additions and 5 deletions
|
@ -851,6 +851,11 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
|
|||
}
|
||||
}
|
||||
|
||||
/// Gets the current configuration applied to all new channels, as
|
||||
pub fn get_current_default_configuration(&self) -> &UserConfig {
|
||||
&self.default_configuration
|
||||
}
|
||||
|
||||
/// Creates a new outbound channel to the given remote node and with the given value.
|
||||
///
|
||||
/// user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
|
||||
|
|
|
@ -62,7 +62,7 @@ pub fn mine_transaction<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, tx: &Transac
|
|||
pub fn confirm_transaction_at<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, tx: &Transaction, conf_height: u32) {
|
||||
let first_connect_height = node.best_block_info().1 + 1;
|
||||
assert!(first_connect_height <= conf_height);
|
||||
if conf_height - first_connect_height >= 1 {
|
||||
if conf_height > first_connect_height {
|
||||
connect_blocks(node, conf_height - first_connect_height);
|
||||
}
|
||||
let mut block = Block {
|
||||
|
@ -281,7 +281,7 @@ impl<'a, 'b, 'c> Drop for Node<'a, 'b, 'c> {
|
|||
let mut w = test_utils::TestVecWriter(Vec::new());
|
||||
self.node.write(&mut w).unwrap();
|
||||
<(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 {
|
||||
default_config: UserConfig::default(),
|
||||
default_config: *self.node.get_current_default_configuration(),
|
||||
keys_manager: self.keys_manager,
|
||||
fee_estimator: &test_utils::TestFeeEstimator { sat_per_kw: 253 },
|
||||
chain_monitor: self.chain_monitor,
|
||||
|
|
|
@ -14,7 +14,6 @@ use chain::Watch;
|
|||
use ln::channelmanager::{ChannelManager, ChannelManagerReadArgs};
|
||||
use ln::features::InitFeatures;
|
||||
use ln::msgs::{ChannelMessageHandler, ErrorAction, HTLCFailChannelUpdate};
|
||||
use util::config::UserConfig;
|
||||
use util::enforcing_trait_impls::EnforcingSigner;
|
||||
use util::events::{Event, EventsProvider, MessageSendEvent, MessageSendEventsProvider};
|
||||
use util::test_utils;
|
||||
|
@ -233,14 +232,13 @@ fn do_test_unconf_chan(reload_node: bool, reorg_after_reload: bool, connect_styl
|
|||
assert!(chan_0_monitor_read.is_empty());
|
||||
|
||||
let mut nodes_0_read = &nodes_0_serialized[..];
|
||||
let config = UserConfig::default();
|
||||
nodes_0_deserialized = {
|
||||
let mut channel_monitors = HashMap::new();
|
||||
channel_monitors.insert(chan_0_monitor.get_funding_txo().0, &mut chan_0_monitor);
|
||||
<(BlockHash, ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster,
|
||||
&test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>)>::read(
|
||||
&mut nodes_0_read, ChannelManagerReadArgs {
|
||||
default_config: config,
|
||||
default_config: *nodes[0].node.get_current_default_configuration(),
|
||||
keys_manager,
|
||||
fee_estimator: node_cfgs[0].fee_estimator,
|
||||
chain_monitor: nodes[0].chain_monitor,
|
||||
|
|
Loading…
Add table
Reference in a new issue