Merge pull request #1998 from tnull/2023-01-no-none-in-channel-relevant-txids
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Wed, 1 Feb 2023 17:48:59 +0000 (17:48 +0000)
committerGitHub <noreply@github.com>
Wed, 1 Feb 2023 17:48:59 +0000 (17:48 +0000)
Only return previously confirmed Txids from CM's `get_relevant_txids()`

lightning/src/chain/mod.rs
lightning/src/ln/channelmanager.rs

index 01eae488700605b2f23c50d5fdfdc0c2319859bc..0370c0840f9b611c99f84f41191ea72d1a5644b5 100644 (file)
@@ -176,6 +176,9 @@ pub trait Confirm {
        /// Returns transactions that must be monitored for reorganization out of the chain along
        /// with the hash of the block as part of which it had been previously confirmed.
        ///
+       /// Note that the returned `Option<BlockHash>` might be `None` for channels created with LDK
+       /// 0.0.112 and prior, in which case you need to manually track previous confirmations.
+       ///
        /// Will include any transactions passed to [`transactions_confirmed`] that have insufficient
        /// confirmations to be safe from a chain reorganization. Will not include any transactions
        /// passed to [`transaction_unconfirmed`], unless later reconfirmed.
index b2a23c7c1d44cbdf03137263c663acaa285774c1..d6068c10536740a7aeef96b02d0d1cf05ac836cd 100644 (file)
@@ -5786,8 +5786,8 @@ where
                        let mut peer_state_lock = peer_state_mutex.lock().unwrap();
                        let peer_state = &mut *peer_state_lock;
                        for chan in peer_state.channel_by_id.values() {
-                               if let (Some(funding_txo), block_hash) = (chan.get_funding_txo(), chan.get_funding_tx_confirmed_in()) {
-                                       res.push((funding_txo.txid, block_hash));
+                               if let (Some(funding_txo), Some(block_hash)) = (chan.get_funding_txo(), chan.get_funding_tx_confirmed_in()) {
+                                       res.push((funding_txo.txid, Some(block_hash)));
                                }
                        }
                }