Skip to content

Commit 787e0a9

Browse files
Set funding_seen_onchain=true in filter_block
Marks funding_seen_onchain when we see the funding tx confirm.
1 parent 3a76374 commit 787e0a9

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
@@ -5902,10 +5902,17 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
59025902

59035903
/// Filters a block's `txdata` for transactions spending watched outputs or for any child
59045904
/// transactions thereof.
5905+
/// While iterating, this also tracks whether we observed the funding transaction.
59055906
#[rustfmt::skip]
5906-
fn filter_block<'a>(&self, txdata: &TransactionData<'a>) -> Vec<&'a Transaction> {
5907+
fn filter_block<'a>(&mut self, txdata: &TransactionData<'a>) -> Vec<&'a Transaction> {
59075908
let mut matched_txn = new_hash_set();
59085909
txdata.iter().filter(|&&(_, tx)| {
5910+
let txid = tx.compute_txid();
5911+
if !self.funding_seen_onchain && (txid == self.funding.funding_txid() ||
5912+
self.pending_funding.iter().any(|f| f.funding_txid() == txid))
5913+
{
5914+
self.funding_seen_onchain = true;
5915+
}
59095916
let mut matches = self.spends_watched_output(tx);
59105917
for input in tx.input.iter() {
59115918
if matches { break; }
@@ -5914,7 +5921,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
59145921
}
59155922
}
59165923
if matches {
5917-
matched_txn.insert(tx.compute_txid());
5924+
matched_txn.insert(txid);
59185925
}
59195926
matches
59205927
}).map(|(_, tx)| *tx).collect()

0 commit comments

Comments
 (0)