Skip to content

Commit 762c6c3

Browse files
Set funding_seen_onchain=true on filter_block if seen
1 parent f6760ec commit 762c6c3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5818,10 +5818,17 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
58185818

58195819
/// Filters a block's `txdata` for transactions spending watched outputs or for any child
58205820
/// transactions thereof.
5821+
/// While iterating, this also tracks whether we observed the funding transaction.
58215822
#[rustfmt::skip]
5822-
fn filter_block<'a>(&self, txdata: &TransactionData<'a>) -> Vec<&'a Transaction> {
5823+
fn filter_block<'a>(&mut self, txdata: &TransactionData<'a>) -> Vec<&'a Transaction> {
58235824
let mut matched_txn = new_hash_set();
58245825
txdata.iter().filter(|&&(_, tx)| {
5826+
let txid = tx.compute_txid();
5827+
if !self.funding_seen_onchain && (txid == self.funding.funding_txid() ||
5828+
self.pending_funding.iter().any(|f| f.funding_txid() == txid))
5829+
{
5830+
self.funding_seen_onchain = true;
5831+
}
58255832
let mut matches = self.spends_watched_output(tx);
58265833
for input in tx.input.iter() {
58275834
if matches { break; }
@@ -5830,7 +5837,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
58305837
}
58315838
}
58325839
if matches {
5833-
matched_txn.insert(tx.compute_txid());
5840+
matched_txn.insert(txid);
58345841
}
58355842
matches
58365843
}).map(|(_, tx)| *tx).collect()

0 commit comments

Comments
 (0)