13
13
#[ macro_use]
14
14
extern crate lazy_static;
15
15
16
+ use std:: cmp:: Ordering ;
16
17
use std:: collections:: HashMap ;
17
18
use std:: str:: FromStr ;
18
19
@@ -32,7 +33,7 @@ use bitcoin::{
32
33
Sequence , SignedAmount , Transaction , TxIn , TxOut , Txid , Witness ,
33
34
} ;
34
35
use bitcoincore_rpc:: bitcoincore_rpc_json:: {
35
- GetBlockTemplateModes , GetBlockTemplateRules , ScanTxOutRequest ,
36
+ GetBlockTemplateModes , GetBlockTemplateRules , ScanTxOutRequest , GetZmqNotificationsResult ,
36
37
} ;
37
38
38
39
lazy_static ! {
@@ -1424,10 +1425,32 @@ fn test_get_index_info(cl: &Client) {
1424
1425
}
1425
1426
1426
1427
fn test_get_zmq_notifications ( cl : & Client ) {
1427
- let zmq_info = cl. get_zmq_notifications ( ) . unwrap ( ) ;
1428
+ let mut zmq_info = cl. get_zmq_notifications ( ) . unwrap ( ) ;
1429
+
1430
+ // it doesn't matter in which order Bitcoin Core returns the result,
1431
+ // but checking it is easier if it has a known order
1432
+ zmq_info. sort_by ( |a, b| {
1433
+ if a. address < b. address {
1434
+ Ordering :: Less
1435
+ } else if a. address == b. address {
1436
+ Ordering :: Equal
1437
+ } else {
1438
+ Ordering :: Greater
1439
+ }
1440
+ } ) ;
1428
1441
1429
- // no zmq subscribers are configured
1430
- assert ! ( zmq_info. is_empty( ) ) ;
1442
+ assert ! ( zmq_info == vec![
1443
+ GetZmqNotificationsResult {
1444
+ notification_type: "pubrawblock" . to_owned( ) ,
1445
+ address: "tcp://0.0.0.0:28332" . to_owned( ) ,
1446
+ hwm: 1000
1447
+ } ,
1448
+ GetZmqNotificationsResult {
1449
+ notification_type: "pubrawtx" . to_owned( ) ,
1450
+ address: "tcp://0.0.0.0:28333" . to_owned( ) ,
1451
+ hwm: 1000
1452
+ } ,
1453
+ ] ) ;
1431
1454
}
1432
1455
1433
1456
fn test_stop ( cl : Client ) {
0 commit comments