@@ -221,22 +221,25 @@ where
221
221
& self , confirmables : & Vec < & ( dyn Confirm + Sync ) > ,
222
222
) -> Result < ( ) , Error > {
223
223
let client = & * self . blockchain ;
224
- // Query the interface for relevant txids and check whether they have been
225
- // reorged-out of the chain.
226
- let relevant_txids =
227
- confirmables. iter ( ) . flat_map ( |c| c. get_relevant_txids ( ) ) . collect :: < HashSet < Txid > > ( ) ;
228
- for txid in relevant_txids {
229
- let tx_unconfirmed = client
230
- . get_tx_status ( & txid)
231
- . await
232
- . ok ( )
233
- . unwrap_or ( None )
234
- . map_or ( true , |status| !status. confirmed ) ;
235
- if tx_unconfirmed {
236
- for c in confirmables {
237
- c. transaction_unconfirmed ( & txid) ;
224
+ // Query the interface for relevant txids and check whether the relevant blocks are still
225
+ // in the best chain, mark them unconfirmed otherwise. If the transactions have been
226
+ // reconfirmed in another block, we'll confirm them in the next sync iteration.
227
+ let relevant_txids = confirmables
228
+ . iter ( )
229
+ . flat_map ( |c| c. get_relevant_txids ( ) )
230
+ . collect :: < HashSet < ( Txid , Option < BlockHash > ) > > ( ) ;
231
+ for ( txid, block_hash_opt) in relevant_txids {
232
+ if let Some ( block_hash) = block_hash_opt {
233
+ let block_status = client. get_block_status ( & block_hash) . await ?;
234
+ if block_status. in_best_chain {
235
+ // Skip if the block in queestion is still confirmed.
236
+ continue ;
238
237
}
239
238
}
239
+
240
+ for c in confirmables {
241
+ c. transaction_unconfirmed ( & txid) ;
242
+ }
240
243
}
241
244
242
245
Ok ( ( ) )
0 commit comments