@@ -326,36 +326,16 @@ where
326
326
let relevant_txids = confirmables
327
327
. iter ( )
328
328
. flat_map ( |c| c. get_relevant_txids ( ) )
329
- . collect :: < HashSet < ( Txid , Option < BlockHash > ) > > ( ) ;
329
+ . collect :: < HashSet < ( Txid , u32 , Option < BlockHash > ) > > ( ) ;
330
330
331
331
let mut unconfirmed_txs = Vec :: new ( ) ;
332
332
333
- for ( txid, block_hash_opt) in relevant_txids {
333
+ for ( txid, conf_height , block_hash_opt) in relevant_txids {
334
334
if let Some ( block_hash) = block_hash_opt {
335
- match self . client . transaction_get ( & txid) {
336
- Ok ( tx) => {
337
- if let Some ( tx_out) = tx. output . first ( ) {
338
- let script_history = self . client . script_get_history ( & tx_out. script_pubkey ) ?;
339
- if let Some ( history) = script_history. iter ( )
340
- . filter ( |h| h. tx_hash == txid) . max_by_key ( |x| x. height )
341
- {
342
- let prob_conf_height = history. height ;
343
- let block_header = self . client . block_header (
344
- prob_conf_height as usize ) ?;
345
- if block_header. block_hash ( ) == block_hash {
346
- // Skip if the tx is still confirmed in the block in question.
347
- continue ;
348
- }
349
- }
350
- }
351
- }
352
- Err ( electrum_client:: Error :: Protocol ( _) ) => {
353
- // We couldn't find the tx, unconfirming..
354
- }
355
- Err ( e) => {
356
- log_error ! ( self . logger, "Failed to look up transaction {}: {}." , txid, e) ;
357
- return Err ( InternalError :: Failed ) ;
358
- }
335
+ let block_header = self . client . block_header ( conf_height as usize ) ?;
336
+ if block_header. block_hash ( ) == block_hash {
337
+ // Skip if the tx is still confirmed in the block in question.
338
+ continue ;
359
339
}
360
340
361
341
unconfirmed_txs. push ( txid) ;
0 commit comments