@@ -990,7 +990,7 @@ impl StakingQuerier {
990
990
#[ cfg( feature = "cosmwasm_1_3" ) ]
991
991
#[ derive( Clone , Default ) ]
992
992
pub struct DistributionQuerier {
993
- withdraw_addresses : HashMap < String , String > ,
993
+ withdraw_addresses : BTreeMap < String , String > ,
994
994
/// Mock of accumulated rewards, indexed first by delegator and then validator address.
995
995
rewards : BTreeMap < String , BTreeMap < String , Vec < DecCoin > > > ,
996
996
/// Mock of validators that a delegator has bonded to.
@@ -2363,4 +2363,26 @@ mod tests {
2363
2363
fn making_an_address_with_empty_prefix_should_panic ( ) {
2364
2364
MockApi :: default ( ) . with_prefix ( "" ) . addr_make ( "creator" ) ;
2365
2365
}
2366
+
2367
+ #[ test]
2368
+ fn distribution_querier_new_works ( ) {
2369
+ let addresses = [
2370
+ ( "addr0000" . to_string ( ) , "addr0001" . to_string ( ) ) ,
2371
+ ( "addr0002" . to_string ( ) , "addr0001" . to_string ( ) ) ,
2372
+ ] ;
2373
+ let btree_map = BTreeMap :: from ( addresses. clone ( ) ) ;
2374
+
2375
+ // should still work with HashMap
2376
+ let hashmap = HashMap :: from ( addresses. clone ( ) ) ;
2377
+ let querier = DistributionQuerier :: new ( hashmap) ;
2378
+ assert_eq ! ( querier. withdraw_addresses, btree_map) ;
2379
+
2380
+ // should work with BTreeMap
2381
+ let querier = DistributionQuerier :: new ( btree_map. clone ( ) ) ;
2382
+ assert_eq ! ( querier. withdraw_addresses, btree_map) ;
2383
+
2384
+ // should work with array
2385
+ let querier = DistributionQuerier :: new ( addresses) ;
2386
+ assert_eq ! ( querier. withdraw_addresses, btree_map) ;
2387
+ }
2366
2388
}
0 commit comments