Skip to content

Commit d4a6612

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 cd33154 commit d4a6612

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
@@ -8703,6 +8703,25 @@ impl<SP: Deref> FundedChannel<SP> where
87038703
Ok((None, timed_out_htlcs, announcement_sigs))
87048704
}
87058705

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

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