@@ -461,7 +461,7 @@ fn test_electrum_syncs() {
461
461
assert ! ( confirmable. confirmed_txs. lock( ) . unwrap( ) . contains_key( & txid) ) ;
462
462
assert ! ( confirmable. unconfirmed_txs. lock( ) . unwrap( ) . is_empty( ) ) ;
463
463
464
- // Now take a random output of the first transaction and check we'll confirm its spend.
464
+ // Now take an arbitrary output of the second transaction and check we'll confirm its spend.
465
465
let tx_res = bitcoind. client . get_transaction ( & second_txid, None ) . unwrap ( ) ;
466
466
let block_hash = tx_res. info . blockhash . unwrap ( ) ;
467
467
let tx = tx_res. transaction ( ) . unwrap ( ) ;
@@ -505,19 +505,22 @@ fn test_electrum_syncs() {
505
505
assert ! ( confirmable. unconfirmed_txs. lock( ) . unwrap( ) . is_empty( ) ) ;
506
506
507
507
// Check we got unconfirmed, then reconfirmed in the meantime.
508
+ let mut seen_txids = HashSet :: new ( ) ;
508
509
let events = std:: mem:: take ( & mut * confirmable. events . lock ( ) . unwrap ( ) ) ;
509
510
assert_eq ! ( events. len( ) , 5 ) ;
510
511
511
512
match events[ 0 ] {
512
513
TestConfirmableEvent :: Unconfirmed ( t) => {
513
514
assert ! ( t == txid || t == second_txid) ;
515
+ assert ! ( seen_txids. insert( t) ) ;
514
516
} ,
515
517
_ => panic ! ( "Unexpected event" ) ,
516
518
}
517
519
518
520
match events[ 1 ] {
519
521
TestConfirmableEvent :: Unconfirmed ( t) => {
520
522
assert ! ( t == txid || t == second_txid) ;
523
+ assert ! ( seen_txids. insert( t) ) ;
521
524
} ,
522
525
_ => panic ! ( "Unexpected event" ) ,
523
526
}
@@ -530,14 +533,18 @@ fn test_electrum_syncs() {
530
533
match events[ 3 ] {
531
534
TestConfirmableEvent :: Confirmed ( t, _, _) => {
532
535
assert ! ( t == txid || t == second_txid) ;
536
+ assert ! ( seen_txids. remove( & t) ) ;
533
537
} ,
534
538
_ => panic ! ( "Unexpected event" ) ,
535
539
}
536
540
537
541
match events[ 4 ] {
538
542
TestConfirmableEvent :: Confirmed ( t, _, _) => {
539
543
assert ! ( t == txid || t == second_txid) ;
544
+ assert ! ( seen_txids. remove( & t) ) ;
540
545
} ,
541
546
_ => panic ! ( "Unexpected event" ) ,
542
547
}
548
+
549
+ assert_eq ! ( seen_txids. len( ) , 0 ) ;
543
550
}
0 commit comments