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