Skip to content

Commit 2d110b9

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 55449b4 commit 2d110b9

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
@@ -8699,6 +8699,25 @@ impl<SP: Deref> FundedChannel<SP> where
86998699
Ok((None, timed_out_htlcs, announcement_sigs))
87008700
}
87018701

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

98659879
/// 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)