@@ -166,15 +166,15 @@ impl StakeAddressMap {
166166 }
167167
168168 /// Get Pool Delegators with live_stakes
169- pub fn get_pool_delegators ( & self , pool_operator : & PoolId ) -> Vec < ( KeyHash , u64 ) > {
169+ pub fn get_pool_delegators ( & self , pool_operator : & PoolId ) -> Vec < ( StakeAddress , u64 ) > {
170170 // Find stake addresses delegated to pool_operator
171- let delegators: Vec < ( KeyHash , u64 ) > = self
171+ let delegators: Vec < ( StakeAddress , u64 ) > = self
172172 . inner
173173 . iter ( )
174174 . filter_map ( |( stake_address, sas) | match sas. delegated_spo . as_ref ( ) {
175175 Some ( delegated_spo) => {
176176 if delegated_spo. eq ( pool_operator) {
177- Some ( ( * stake_address. get_hash ( ) , sas. utxo_value + sas. rewards ) )
177+ Some ( ( stake_address. clone ( ) , sas. utxo_value + sas. rewards ) )
178178 } else {
179179 None
180180 }
@@ -212,14 +212,13 @@ impl StakeAddressMap {
212212 pub fn get_accounts_utxo_values_map (
213213 & self ,
214214 stake_addresses : & [ StakeAddress ] ,
215- ) -> Option < HashMap < KeyHash , u64 > > {
215+ ) -> Option < HashMap < StakeAddress , u64 > > {
216216 let mut map = HashMap :: new ( ) ;
217217
218218 for stake_address in stake_addresses {
219219 let account = self . get ( stake_address) ?;
220220 let utxo_value = account. utxo_value ;
221- let key_hash = stake_address. get_hash ( ) ;
222- map. insert ( * key_hash, utxo_value) ;
221+ map. insert ( stake_address. clone ( ) , utxo_value) ;
223222 }
224223
225224 Some ( map)
@@ -230,14 +229,13 @@ impl StakeAddressMap {
230229 pub fn get_accounts_balances_map (
231230 & self ,
232231 stake_addresses : & [ StakeAddress ] ,
233- ) -> Option < HashMap < KeyHash , u64 > > {
232+ ) -> Option < HashMap < StakeAddress , u64 > > {
234233 let mut map = HashMap :: new ( ) ;
235234
236235 for stake_address in stake_addresses {
237236 let account = self . get ( stake_address) ?;
238237 let balance = account. utxo_value + account. rewards ;
239- let key_hash = stake_address. get_hash ( ) ;
240- map. insert ( * key_hash, balance) ;
238+ map. insert ( stake_address. clone ( ) , balance) ;
241239 }
242240
243241 Some ( map)
@@ -248,14 +246,13 @@ impl StakeAddressMap {
248246 pub fn get_drep_delegations_map (
249247 & self ,
250248 stake_addresses : & [ StakeAddress ] ,
251- ) -> Option < HashMap < KeyHash , Option < DRepChoice > > > {
249+ ) -> Option < HashMap < StakeAddress , Option < DRepChoice > > > {
252250 let mut map = HashMap :: new ( ) ;
253251
254252 for stake_address in stake_addresses {
255253 let account = self . get ( stake_address) ?;
256254 let maybe_drep = account. delegated_drep . clone ( ) ;
257- let key_hash = stake_address. get_hash ( ) ;
258- map. insert ( * key_hash, maybe_drep) ;
255+ map. insert ( stake_address. clone ( ) , maybe_drep) ;
259256 }
260257
261258 Some ( map)
@@ -326,7 +323,7 @@ impl StakeAddressMap {
326323
327324 /// Dump current Stake Pool Delegation Distribution State
328325 /// <PoolId -> (Stake Key, Active Stakes Amount)>
329- pub fn dump_spdd_state ( & self ) -> HashMap < PoolId , Vec < ( KeyHash , u64 ) > > {
326+ pub fn dump_spdd_state ( & self ) -> HashMap < PoolId , Vec < ( StakeAddress , u64 ) > > {
330327 let entries: Vec < _ > = self
331328 . inner
332329 . par_iter ( )
@@ -335,9 +332,9 @@ impl StakeAddressMap {
335332 } )
336333 . collect ( ) ;
337334
338- let mut result: HashMap < PoolId , Vec < ( KeyHash , u64 ) > > = HashMap :: new ( ) ;
335+ let mut result: HashMap < PoolId , Vec < ( StakeAddress , u64 ) > > = HashMap :: new ( ) ;
339336 for ( spo, entry) in entries {
340- result. entry ( spo) . or_default ( ) . push ( ( entry. 0 . get_credential ( ) . get_hash ( ) , entry. 1 ) ) ;
337+ result. entry ( spo) . or_default ( ) . push ( ( entry. 0 , entry. 1 ) ) ;
341338 }
342339 result
343340 }
@@ -1244,8 +1241,8 @@ mod tests {
12441241 let map = stake_addresses. get_accounts_utxo_values_map ( & keys) . unwrap ( ) ;
12451242
12461243 assert_eq ! ( map. len( ) , 2 ) ;
1247- assert_eq ! ( map. get( & addr1. get_hash ( ) ) . copied( ) . unwrap( ) , 1000 ) ;
1248- assert_eq ! ( map. get( & addr2. get_hash ( ) ) . copied( ) . unwrap( ) , 2000 ) ;
1244+ assert_eq ! ( map. get( & addr1) . copied( ) . unwrap( ) , 1000 ) ;
1245+ assert_eq ! ( map. get( & addr2) . copied( ) . unwrap( ) , 2000 ) ;
12491246 }
12501247
12511248 #[ test]
@@ -1358,8 +1355,8 @@ mod tests {
13581355 let map = stake_addresses. get_accounts_balances_map ( & addresses) . unwrap ( ) ;
13591356
13601357 assert_eq ! ( map. len( ) , 2 ) ;
1361- assert_eq ! ( map. get( & addr1. get_hash ( ) ) . copied( ) . unwrap( ) , 1100 ) ;
1362- assert_eq ! ( map. get( & addr2. get_hash ( ) ) . copied( ) . unwrap( ) , 2000 ) ;
1358+ assert_eq ! ( map. get( & addr1) . copied( ) . unwrap( ) , 1100 ) ;
1359+ assert_eq ! ( map. get( & addr2) . copied( ) . unwrap( ) , 2000 ) ;
13631360 }
13641361
13651362 #[ test]
@@ -1467,14 +1464,14 @@ mod tests {
14671464
14681465 assert_eq ! ( map. len( ) , 3 ) ;
14691466 assert_eq ! (
1470- map. get( & addr1. get_hash ( ) ) . unwrap( ) ,
1467+ map. get( & addr1) . unwrap( ) ,
14711468 & Some ( DRepChoice :: Abstain )
14721469 ) ;
14731470 assert_eq ! (
1474- map. get( & addr2. get_hash ( ) ) . unwrap( ) ,
1471+ map. get( & addr2) . unwrap( ) ,
14751472 & Some ( DRepChoice :: Key ( DREP_HASH ) )
14761473 ) ;
1477- assert_eq ! ( map. get( & addr3. get_hash ( ) ) . unwrap( ) , & None ) ;
1474+ assert_eq ! ( map. get( & addr3) . unwrap( ) , & None ) ;
14781475 }
14791476
14801477 #[ test]
0 commit comments