Skip to content

Commit 8c921d3

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 2aae372 commit 8c921d3

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

lightning/src/ln/channel.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9317,6 +9317,27 @@ where
93179317
Ok((None, timed_out_htlcs, announcement_sigs))
93189318
}
93199319

9320+
pub fn get_relevant_txids(&self) -> impl Iterator<Item = (Txid, u32, Option<BlockHash>)> + '_ {
9321+
core::iter::once(&self.funding)
9322+
.chain(self.pending_funding.iter())
9323+
.map(|funding| {
9324+
(
9325+
funding.get_funding_txid(),
9326+
funding.get_funding_tx_confirmation_height(),
9327+
funding.funding_tx_confirmed_in,
9328+
)
9329+
})
9330+
.filter_map(|(txid_opt, height_opt, hash_opt)| {
9331+
if let (Some(funding_txid), Some(conf_height), Some(block_hash)) =
9332+
(txid_opt, height_opt, hash_opt)
9333+
{
9334+
Some((funding_txid, conf_height, Some(block_hash)))
9335+
} else {
9336+
None
9337+
}
9338+
})
9339+
}
9340+
93209341
/// Checks if any funding transaction is no longer confirmed in the main chain. This may
93219342
/// force-close the channel, but may also indicate a harmless reorganization of a block or two
93229343
/// before the channel has reached channel_ready or splice_locked, and we can just wait for more
@@ -10502,11 +10523,6 @@ where
1050210523
}
1050310524
}
1050410525

10505-
/// Returns the block hash in which our funding transaction was confirmed.
10506-
pub fn get_funding_tx_confirmed_in(&self) -> Option<BlockHash> {
10507-
self.funding.funding_tx_confirmed_in
10508-
}
10509-
1051010526
#[cfg(splicing)]
1051110527
pub fn has_pending_splice(&self) -> bool {
1051210528
self.pending_splice.is_some()

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11949,11 +11949,8 @@ where
1194911949
let mut peer_state_lock = peer_state_mutex.lock().unwrap();
1195011950
let peer_state = &mut *peer_state_lock;
1195111951
for chan in peer_state.channel_by_id.values().filter_map(Channel::as_funded) {
11952-
let txid_opt = chan.funding.get_funding_txo();
11953-
let height_opt = chan.funding.get_funding_tx_confirmation_height();
11954-
let hash_opt = chan.get_funding_tx_confirmed_in();
11955-
if let (Some(funding_txo), Some(conf_height), Some(block_hash)) = (txid_opt, height_opt, hash_opt) {
11956-
res.push((funding_txo.txid, conf_height, Some(block_hash)));
11952+
for (funding_txid, conf_height, block_hash) in chan.get_relevant_txids() {
11953+
res.push((funding_txid, conf_height, block_hash));
1195711954
}
1195811955
}
1195911956
}

0 commit comments

Comments
 (0)