@@ -326,7 +326,10 @@ where
326326 self . by_key
327327 . iter ( )
328328 . map ( move |( key, entry) | {
329- ( key. clone ( ) , entry. read_value ( ) . power ( capability, current_epoch) )
329+ (
330+ key. clone ( ) ,
331+ entry. read_value ( ) . power ( capability, current_epoch) ,
332+ )
330333 } )
331334 . sorted_by ( |( key_1, power_1) , ( key_2, power_2) | {
332335 if power_1 == power_2 {
@@ -417,7 +420,7 @@ where
417420 pub fn reset_mining_age < ISK > (
418421 & mut self ,
419422 validator : ISK ,
420- current_epoch : Epoch
423+ current_epoch : Epoch ,
421424 ) -> StakesResult < ( ) , Address , Coins , Epoch >
422425 where
423426 ISK : Into < Address > ,
@@ -427,15 +430,15 @@ where
427430 // order mining stake entries by rank, as for given current_epoch:
428431 // let stakes_clone = self.clone();
429432 let by_rank = self . by_rank ( Capability :: Mining , current_epoch) ;
430-
433+
431434 // locate first entry whose validator matches the one searched for:
432- let winner_rank = by_rank. clone ( ) . position ( |( key, _) | key. validator == validator) ;
433-
435+ let winner_rank = by_rank
436+ . clone ( )
437+ . position ( |( key, _) | key. validator == validator) ;
438+
434439 if let Some ( winner_rank) = winner_rank {
435- let stakers: Vec < StakeKey < Address > > = by_rank
436- . take ( winner_rank + 1 )
437- . map ( |( key, _) | key)
438- . collect ( ) ;
440+ let stakers: Vec < StakeKey < Address > > =
441+ by_rank. take ( winner_rank + 1 ) . map ( |( key, _) | key) . collect ( ) ;
439442 // proportionally reset coin age on located entry and all those with a better mining rank:
440443 let mut index: usize = 0 ;
441444 stakers. iter ( ) . for_each ( |key| {
@@ -444,7 +447,10 @@ where
444447 let penalty_epochs = Epoch :: from ( ( 1 + winner_rank - index) as u32 ) ;
445448 log:: debug!(
446449 "Resetting mining power of {} (ranked as #{}) during +{} epochs to {}" ,
447- key, index + 1 , penalty_epochs, current_epoch + penalty_epochs
450+ key,
451+ index + 1 ,
452+ penalty_epochs,
453+ current_epoch + penalty_epochs
448454 ) ;
449455 stake_entry
450456 . value
@@ -1140,7 +1146,9 @@ mod tests {
11401146 ]
11411147 ) ;
11421148 assert_eq ! (
1143- stakes. by_rank( Capability :: Witnessing , 100 ) . collect:: <Vec <_>>( ) ,
1149+ stakes
1150+ . by_rank( Capability :: Witnessing , 100 )
1151+ . collect:: <Vec <_>>( ) ,
11441152 [
11451153 ( charlie_erin. into( ) , 2100 ) ,
11461154 ( bob_david. into( ) , 1600 ) ,
@@ -1179,7 +1187,9 @@ mod tests {
11791187 ]
11801188 ) ;
11811189 assert_eq ! (
1182- stakes. by_rank( Capability :: Witnessing , 101 ) . collect:: <Vec <_>>( ) ,
1190+ stakes
1191+ . by_rank( Capability :: Witnessing , 101 )
1192+ . collect:: <Vec <_>>( ) ,
11831193 [
11841194 ( charlie_erin. into( ) , 2_130 ) ,
11851195 ( bob_david. into( ) , 1_620 ) ,
@@ -1220,7 +1230,9 @@ mod tests {
12201230 ]
12211231 ) ;
12221232 assert_eq ! (
1223- stakes. by_rank( Capability :: Witnessing , 300 ) . collect:: <Vec <_>>( ) ,
1233+ stakes
1234+ . by_rank( Capability :: Witnessing , 300 )
1235+ . collect:: <Vec <_>>( ) ,
12241236 [
12251237 ( charlie_erin. into( ) , 8_100 ) ,
12261238 ( bob_david. into( ) , 5_600 ) ,
0 commit comments