Skip to content

Commit 58d3411

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 ac497a3 commit 58d3411

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,10 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
12031203
feerate_per_kw: initial_local_commitment_tx.feerate_per_kw,
12041204
htlc_outputs: Vec::new(), // There are never any HTLCs in the initial commitment transactions
12051205
};
1206+
1207+
let mut outputs_to_watch = HashMap::new();
1208+
outputs_to_watch.insert(funding_info.0.txid, vec![funding_info.1.clone()]);
1209+
12061210
// Returning a monitor error before updating tracking points means in case of using
12071211
// a concurrent watchtower implementation for same channel, if this one doesn't
12081212
// reject update as we do, you MAY have the latest local valid commitment tx onchain
@@ -1246,7 +1250,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
12461250
pending_events: Vec::new(),
12471251

12481252
onchain_events_waiting_threshold_conf: HashMap::new(),
1249-
outputs_to_watch: HashMap::new(),
1253+
outputs_to_watch,
12501254

12511255
onchain_tx_handler,
12521256

lightning/src/chain/mod.rs

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

0 commit comments

Comments
 (0)