Skip to content

Commit 4306b03

Browse files
committed
Include funding TXO in outputs to watch
The funding TXO was never added to ChannelMonitor's outputs_to_watch in 73dce20. Include it when constructing a ChannelMonitor.
1 parent ed3af56 commit 4306b03

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lightning/src/chain/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ pub trait Watch: Send + Sync {
7272
/// Watches a channel identified by `funding_txo` using `monitor`.
7373
///
7474
/// Implementations are responsible for watching the chain for the funding transaction along
75-
/// with spends of its output and any outputs returned by [`get_outputs_to_watch`]. In practice,
76-
/// this means calling [`block_connected`] and [`block_disconnected`] on the monitor and
77-
/// including all such transactions that meet this criteria.
75+
/// with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
76+
/// calling [`block_connected`] and [`block_disconnected`] on the monitor and including all such
77+
/// transactions that meet this criteria.
7878
///
7979
/// [`get_outputs_to_watch`]: ../ln/channelmonitor/struct.ChannelMonitor.html#method.get_outputs_to_watch
8080
/// [`block_connected`]: ../ln/channelmonitor/struct.ChannelMonitor.html#method.block_connected

lightning/src/ln/channelmonitor.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,9 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
12461246
};
12471247
onchain_tx_handler.provide_latest_holder_tx(initial_holder_commitment_tx);
12481248

1249+
let mut outputs_to_watch = HashMap::new();
1250+
outputs_to_watch.insert(funding_info.0.txid, vec![funding_info.1.clone()]);
1251+
12491252
ChannelMonitor {
12501253
latest_update_id: 0,
12511254
commitment_transaction_number_obscure_factor,
@@ -1282,7 +1285,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
12821285
pending_events: Vec::new(),
12831286

12841287
onchain_events_waiting_threshold_conf: HashMap::new(),
1285-
outputs_to_watch: HashMap::new(),
1288+
outputs_to_watch,
12861289

12871290
onchain_tx_handler,
12881291

0 commit comments

Comments
 (0)