Skip to content

Commit 1869f3d

Browse files
committed
Clarify ChannelManager docs somewhat around full blocks
As suggested by Val.
1 parent da44253 commit 1869f3d

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

lightning/src/ln/channelmanager.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -4007,8 +4007,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> Writeable f
40074007
/// ChannelManager)>::read(reader, args).
40084008
/// This may result in closing some Channels if the ChannelMonitor is newer than the stored
40094009
/// ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
4010-
/// 3) Register all relevant ChannelMonitor outpoints with your chain watch mechanism using
4011-
/// ChannelMonitor::get_outputs_to_watch() and ChannelMonitor::get_funding_txo().
4010+
/// 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
4011+
/// way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
4012+
/// ChannelMonitor::get_funding_txo().
40124013
/// 4) Reconnect blocks on your ChannelMonitors.
40134014
/// 5) Disconnect/connect blocks on the ChannelManager.
40144015
/// 6) Move the ChannelMonitors into your local chain::Watch.

lightning/src/ln/reorg_tests.rs

+2
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ fn do_test_unconf_chan(reload_node: bool, reorg_after_reload: bool) {
278278
}
279279
}
280280

281+
// With expect_channel_force_closed set the TestChainMonitor will enforce that the next update
282+
// is a ChannelForcClosed on the right channel with should_broadcast set.
281283
*nodes[0].chain_monitor.expect_channel_force_closed.lock().unwrap() = Some((chan_id, true));
282284
nodes[0].node.test_process_background_events(); // Required to free the pending background monitor update
283285
check_added_monitors!(nodes[0], 1);

lightning/src/util/test_utils.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,12 @@ pub struct TestChainMonitor<'a> {
8282
pub chain_monitor: chainmonitor::ChainMonitor<EnforcingSigner, &'a TestChainSource, &'a chaininterface::BroadcasterInterface, &'a TestFeeEstimator, &'a TestLogger, &'a channelmonitor::Persist<EnforcingSigner>>,
8383
pub keys_manager: &'a TestKeysInterface,
8484
pub update_ret: Mutex<Option<Result<(), channelmonitor::ChannelMonitorUpdateErr>>>,
85-
// If this is set to Some(), after the next return, we'll always return this until update_ret
86-
// is changed:
85+
/// If this is set to Some(), after the next return, we'll always return this until update_ret
86+
/// is changed:
8787
pub next_update_ret: Mutex<Option<Result<(), channelmonitor::ChannelMonitorUpdateErr>>>,
88+
/// If this is set to Some(), the next update_channel call (not watch_channel) must be a
89+
/// ChannelForceClosed event for the given channel_id with should_broadcast set to the given
90+
/// boolean.
8891
pub expect_channel_force_closed: Mutex<Option<([u8; 32], bool)>>,
8992
}
9093
impl<'a> TestChainMonitor<'a> {

0 commit comments

Comments
 (0)