Skip to content

Commit a92a416

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 a90ccb6 commit a92a416

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

lightning/src/ln/channel.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9365,6 +9365,27 @@ where
93659365
Ok((None, timed_out_htlcs, announcement_sigs))
93669366
}
93679367

9368+
pub fn get_relevant_txids(&self) -> impl Iterator<Item = (Txid, u32, Option<BlockHash>)> + '_ {
9369+
core::iter::once(&self.funding)
9370+
.chain(self.pending_funding.iter())
9371+
.map(|funding| {
9372+
(
9373+
funding.get_funding_txid(),
9374+
funding.get_funding_tx_confirmation_height(),
9375+
funding.funding_tx_confirmed_in,
9376+
)
9377+
})
9378+
.filter_map(|(txid_opt, height_opt, hash_opt)| {
9379+
if let (Some(funding_txid), Some(conf_height), Some(block_hash)) =
9380+
(txid_opt, height_opt, hash_opt)
9381+
{
9382+
Some((funding_txid, conf_height, Some(block_hash)))
9383+
} else {
9384+
None
9385+
}
9386+
})
9387+
}
9388+
93689389
/// Checks if any funding transaction is no longer confirmed in the main chain. This may
93699390
/// force-close the channel, but may also indicate a harmless reorganization of a block or two
93709391
/// before the channel has reached channel_ready or splice_locked, and we can just wait for more
@@ -10548,11 +10569,6 @@ where
1054810569
}
1054910570
}
1055010571

10551-
/// Returns the block hash in which our funding transaction was confirmed.
10552-
pub fn get_funding_tx_confirmed_in(&self) -> Option<BlockHash> {
10553-
self.funding.funding_tx_confirmed_in
10554-
}
10555-
1055610572
#[cfg(splicing)]
1055710573
pub fn has_pending_splice(&self) -> bool {
1055810574
self.pending_splice.is_some()

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12095,13 +12095,8 @@ where
1209512095
let mut peer_state_lock = peer_state_mutex.lock().unwrap();
1209612096
let peer_state = &mut *peer_state_lock;
1209712097
for chan in peer_state.channel_by_id.values().filter_map(Channel::as_funded) {
12098-
let txid_opt = chan.funding.get_funding_txo();
12099-
let height_opt = chan.funding.get_funding_tx_confirmation_height();
12100-
let hash_opt = chan.get_funding_tx_confirmed_in();
12101-
if let (Some(funding_txo), Some(conf_height), Some(block_hash)) =
12102-
(txid_opt, height_opt, hash_opt)
12103-
{
12104-
res.push((funding_txo.txid, conf_height, Some(block_hash)));
12098+
for (funding_txid, conf_height, block_hash) in chan.get_relevant_txids() {
12099+
res.push((funding_txid, conf_height, block_hash));
1210512100
}
1210612101
}
1210712102
}

0 commit comments

Comments
 (0)