Skip to content

Commit 8315949

Browse files
committed
Check all FundingScopes in get_relevant_txids
Pending funding transactions for splices should be monitored for appearance on chain. Include these in ChannelManager::get_relevant_txids so that they can be watched.
1 parent 30df421 commit 8315949

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

lightning/src/ln/channel.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8702,6 +8702,25 @@ impl<SP: Deref> FundedChannel<SP> where
87028702
Ok((None, timed_out_htlcs, announcement_sigs))
87038703
}
87048704

8705+
pub fn get_relevant_txids(&self) -> impl Iterator<Item=(Txid, u32, Option<BlockHash>)> + '_ {
8706+
core::iter::once(&self.funding)
8707+
.chain(self.pending_funding.iter())
8708+
.map(|funding|
8709+
(
8710+
funding.get_funding_txid(),
8711+
funding.get_funding_tx_confirmation_height(),
8712+
funding.funding_tx_confirmed_in,
8713+
)
8714+
)
8715+
.filter_map(|(txid_opt, height_opt, hash_opt)|
8716+
if let (Some(funding_txid), Some(conf_height), Some(block_hash)) = (txid_opt, height_opt, hash_opt) {
8717+
Some((funding_txid, conf_height, Some(block_hash)))
8718+
} else {
8719+
None
8720+
}
8721+
)
8722+
}
8723+
87058724
/// Checks if any funding transaction is no longer confirmed in the main chain. This may
87068725
/// force-close the channel, but may also indicate a harmless reorganization of a block or two
87078726
/// before the channel has reached channel_ready or splice_locked, and we can just wait for more
@@ -9858,11 +9877,6 @@ impl<SP: Deref> FundedChannel<SP> where
98589877
pub fn is_v2_established(&self) -> bool {
98599878
self.is_v2_established
98609879
}
9861-
9862-
/// Returns the block hash in which our funding transaction was confirmed.
9863-
pub fn get_funding_tx_confirmed_in(&self) -> Option<BlockHash> {
9864-
self.funding.funding_tx_confirmed_in
9865-
}
98669880
}
98679881

98689882
/// A not-yet-funded outbound (from holder) channel using V1 channel establishment.

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11673,11 +11673,8 @@ where
1167311673
let mut peer_state_lock = peer_state_mutex.lock().unwrap();
1167411674
let peer_state = &mut *peer_state_lock;
1167511675
for chan in peer_state.channel_by_id.values().filter_map(Channel::as_funded) {
11676-
let txid_opt = chan.funding.get_funding_txo();
11677-
let height_opt = chan.funding.get_funding_tx_confirmation_height();
11678-
let hash_opt = chan.get_funding_tx_confirmed_in();
11679-
if let (Some(funding_txo), Some(conf_height), Some(block_hash)) = (txid_opt, height_opt, hash_opt) {
11680-
res.push((funding_txo.txid, conf_height, Some(block_hash)));
11676+
for (funding_txid, conf_height, block_hash) in chan.get_relevant_txids() {
11677+
res.push((funding_txid, conf_height, block_hash));
1168111678
}
1168211679
}
1168311680
}

0 commit comments

Comments
 (0)