11use {
22 crate :: {
3- hyperlane_contract, ConnectionConf , DangoConvertor , DangoProvider , DangoResult ,
3+ hyperlane_contract, ConnectionConf , DangoConvertor , DangoError , DangoProvider , DangoResult ,
44 DangoSigner , TryDangoConvertor ,
55 } ,
6+ anyhow:: anyhow,
67 async_trait:: async_trait,
78 dango_hyperlane_types:: va:: {
89 ExecuteMsg , QueryAnnounceFeePerByteRequest , QueryAnnouncedStorageLocationsRequest ,
@@ -74,9 +75,9 @@ impl ValidatorAnnounce for DangoValidatorAnnounce {
7475 /// Returns the announced storage locations for the provided validators.
7576 async fn get_announced_storage_locations (
7677 & self ,
77- validators : & [ H256 ] ,
78+ val_input : & [ H256 ] ,
7879 ) -> ChainResult < Vec < Vec < String > > > {
79- let validators = validators
80+ let validators = val_input
8081 . iter ( )
8182 . map ( |v| v. try_convert ( ) )
8283 . collect :: < DangoResult < BTreeSet < _ > > > ( ) ?;
@@ -90,7 +91,20 @@ impl ValidatorAnnounce for DangoValidatorAnnounce {
9091 )
9192 . await ?;
9293
93- Ok ( response. into_values ( ) . map ( Inner :: into_inner) . collect ( ) )
94+ let mut buff = vec ! [ ] ;
95+
96+ for validator in val_input {
97+ if let Some ( locations) = response. get ( & validator. try_convert ( ) ?) {
98+ buff. push ( locations. clone ( ) . into_inner ( ) ) ;
99+ } else {
100+ return Err ( DangoError :: Anyhow ( anyhow ! (
101+ "location not found for validator {}" ,
102+ validator
103+ ) ) ) ?;
104+ }
105+ }
106+
107+ Ok ( buff)
94108 }
95109
96110 /// Announce a storage location for a validator
0 commit comments