Skip to content

Commit a3c2f48

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 776d762 commit a3c2f48

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
@@ -8866,6 +8866,25 @@ impl<SP: Deref> FundedChannel<SP> where
88668866
Ok((None, timed_out_htlcs, announcement_sigs))
88678867
}
88688868

8869+
pub fn get_relevant_txids(&self) -> impl Iterator<Item=(Txid, u32, Option<BlockHash>)> + '_ {
8870+
core::iter::once(&self.funding)
8871+
.chain(self.pending_funding.iter())
8872+
.map(|funding|
8873+
(
8874+
funding.get_funding_txid(),
8875+
funding.get_funding_tx_confirmation_height(),
8876+
funding.funding_tx_confirmed_in,
8877+
)
8878+
)
8879+
.filter_map(|(txid_opt, height_opt, hash_opt)|
8880+
if let (Some(funding_txid), Some(conf_height), Some(block_hash)) = (txid_opt, height_opt, hash_opt) {
8881+
Some((funding_txid, conf_height, Some(block_hash)))
8882+
} else {
8883+
None
8884+
}
8885+
)
8886+
}
8887+
88698888
/// Checks if any funding transaction is no longer confirmed in the main chain. This may
88708889
/// force-close the channel, but may also indicate a harmless reorganization of a block or two
88718890
/// before the channel has reached channel_ready or splice_locked, and we can just wait for more
@@ -10044,11 +10063,6 @@ impl<SP: Deref> FundedChannel<SP> where
1004410063
false
1004510064
}
1004610065
}
10047-
10048-
/// Returns the block hash in which our funding transaction was confirmed.
10049-
pub fn get_funding_tx_confirmed_in(&self) -> Option<BlockHash> {
10050-
self.funding.funding_tx_confirmed_in
10051-
}
1005210066
}
1005310067

1005410068
/// 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
@@ -11683,11 +11683,8 @@ where
1168311683
let mut peer_state_lock = peer_state_mutex.lock().unwrap();
1168411684
let peer_state = &mut *peer_state_lock;
1168511685
for chan in peer_state.channel_by_id.values().filter_map(Channel::as_funded) {
11686-
let txid_opt = chan.funding.get_funding_txo();
11687-
let height_opt = chan.funding.get_funding_tx_confirmation_height();
11688-
let hash_opt = chan.get_funding_tx_confirmed_in();
11689-
if let (Some(funding_txo), Some(conf_height), Some(block_hash)) = (txid_opt, height_opt, hash_opt) {
11690-
res.push((funding_txo.txid, conf_height, Some(block_hash)));
11686+
for (funding_txid, conf_height, block_hash) in chan.get_relevant_txids() {
11687+
res.push((funding_txid, conf_height, block_hash));
1169111688
}
1169211689
}
1169311690
}

0 commit comments

Comments
 (0)