Skip to content

Commit

Permalink
refactor: simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
karbyshev committed Jul 10, 2023
1 parent c7dab48 commit e43d5f7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions proof_of_stake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3336,6 +3336,7 @@ where
let infracting_stake = slashes.iter(storage)?.fold(
Ok(Dec::zero()),
|acc: storage_api::Result<Dec>, res| {
let acc = acc?;
let (
NestedSubKey::Data {
key: validator,
Expand All @@ -3349,11 +3350,7 @@ where
.unwrap_or_default();
// println!("Val {} stake: {}", &validator, validator_stake);

if let Ok(inner) = acc {
Ok(inner + Dec::from(validator_stake))
} else {
acc
}
Ok(acc + Dec::from(validator_stake))
// TODO: does something more complex need to be done
// here in the event some of these slashes correspond to
// the same validator?
Expand Down

0 comments on commit e43d5f7

Please sign in to comment.