@@ -21,7 +21,6 @@ use witnet_data_structures::{
2121 proto:: versioning:: ProtocolVersion ,
2222 refresh_protocol_version,
2323 staking:: {
24- errors:: StakesError ,
2524 prelude:: { Power , StakeKey } ,
2625 stakes:: QueryStakesKey ,
2726 } ,
@@ -861,7 +860,7 @@ impl PeersBeacons {
861860 b. as_ref ( )
862861 . map ( |last_beacon| last_beacon. highest_superblock_checkpoint )
863862 } )
864- . chain ( std:: iter:: repeat ( None ) . take ( num_missing_peers) ) ,
863+ . chain ( std:: iter:: repeat_n ( None , num_missing_peers) ) ,
865864 consensus_threshold,
866865 )
867866 // Flatten result:
@@ -1023,7 +1022,7 @@ impl Handler<PeersBeacons> for ChainManager {
10231022 let peers_needed_for_consensus = outbound_limit
10241023 . map ( |x| {
10251024 // ceil(x * consensus_threshold / 100)
1026- ( usize:: from ( x) * consensus_threshold + 99 ) / 100
1025+ ( usize:: from ( x) * consensus_threshold) . div_ceil ( 100 )
10271026 } )
10281027 . unwrap_or ( 1 ) ;
10291028
@@ -1553,11 +1552,7 @@ impl Handler<QueryStakes> for ChainManager {
15531552 let limit = params. limit . unwrap_or ( u16:: MAX ) as usize ;
15541553
15551554 // fetch filtered stake entries from current chain state:
1556- let mut stakes = self
1557- . chain_state
1558- . stakes
1559- . query_stakes ( filter. clone ( ) )
1560- . map_err ( StakesError :: from) ?;
1555+ let mut stakes = self . chain_state . stakes . query_stakes ( filter. clone ( ) ) ?;
15611556
15621557 // filter out stake entries having a nonce, last mining or witnessing epochs (depending
15631558 // on actual ordering field) older than calculated `since_epoch`:
0 commit comments