@@ -5346,6 +5346,19 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
53465346 {
53475347 let funding_seen_before = self . funding_seen_onchain ;
53485348 let txn_matched = self . filter_block ( txdata) ;
5349+
5350+ if !self . funding_seen_onchain {
5351+ for & ( _, tx) in txdata. iter ( ) {
5352+ let txid = tx. compute_txid ( ) ;
5353+ if txid == self . funding . funding_txid ( ) ||
5354+ self . pending_funding . iter ( ) . any ( |f| f. funding_txid ( ) == txid)
5355+ {
5356+ self . funding_seen_onchain = true ;
5357+ break ;
5358+ }
5359+ }
5360+ }
5361+
53495362 for tx in & txn_matched {
53505363 let mut output_val = Amount :: ZERO ;
53515364 for out in tx. output . iter ( ) {
@@ -5940,17 +5953,10 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
59405953
59415954 /// Filters a block's `txdata` for transactions spending watched outputs or for any child
59425955 /// transactions thereof.
5943- /// While iterating, this also tracks whether we observed the funding transaction.
59445956 #[ rustfmt:: skip]
59455957 fn filter_block < ' a > ( & mut self , txdata : & TransactionData < ' a > ) -> Vec < & ' a Transaction > {
59465958 let mut matched_txn = new_hash_set ( ) ;
59475959 txdata. iter ( ) . filter ( |& & ( _, tx) | {
5948- let txid = tx. compute_txid ( ) ;
5949- if !self . funding_seen_onchain && ( txid == self . funding . funding_txid ( ) ||
5950- self . pending_funding . iter ( ) . any ( |f| f. funding_txid ( ) == txid) )
5951- {
5952- self . funding_seen_onchain = true ;
5953- }
59545960 let mut matches = self . spends_watched_output ( tx) ;
59555961 for input in tx. input . iter ( ) {
59565962 if matches { break ; }
@@ -5959,7 +5965,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
59595965 }
59605966 }
59615967 if matches {
5962- matched_txn. insert ( txid ) ;
5968+ matched_txn. insert ( tx . compute_txid ( ) ) ;
59635969 }
59645970 matches
59655971 } ) . map ( |( _, tx) | * tx) . collect ( )
0 commit comments