Skip to content

Commit 8fe756f

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 de53a88 commit 8fe756f

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
@@ -8710,6 +8710,25 @@ impl<SP: Deref> FundedChannel<SP> where
87108710
Ok((None, timed_out_htlcs, announcement_sigs))
87118711
}
87128712

8713+
pub fn get_relevant_txids(&self) -> impl Iterator<Item=(Txid, u32, Option<BlockHash>)> + '_ {
8714+
core::iter::once(&self.funding)
8715+
.chain(self.pending_funding.iter())
8716+
.map(|funding|
8717+
(
8718+
funding.get_funding_txid(),
8719+
funding.get_funding_tx_confirmation_height(),
8720+
funding.funding_tx_confirmed_in,
8721+
)
8722+
)
8723+
.filter_map(|(txid_opt, height_opt, hash_opt)|
8724+
if let (Some(funding_txid), Some(conf_height), Some(block_hash)) = (txid_opt, height_opt, hash_opt) {
8725+
Some((funding_txid, conf_height, Some(block_hash)))
8726+
} else {
8727+
None
8728+
}
8729+
)
8730+
}
8731+
87138732
/// Checks if any funding transaction is no longer confirmed in the main chain. This may
87148733
/// force-close the channel, but may also indicate a harmless reorganization of a block or two
87158734
/// before the channel has reached channel_ready or splice_locked, and we can just wait for more
@@ -9866,11 +9885,6 @@ impl<SP: Deref> FundedChannel<SP> where
98669885
pub fn is_v2_established(&self) -> bool {
98679886
self.is_v2_established
98689887
}
9869-
9870-
/// Returns the block hash in which our funding transaction was confirmed.
9871-
pub fn get_funding_tx_confirmed_in(&self) -> Option<BlockHash> {
9872-
self.funding.funding_tx_confirmed_in
9873-
}
98749888
}
98759889

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