Skip to content

Commit

Permalink
don't panic in compute
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Reif <Garandor@manta.network>
  • Loading branch information
Adam Reif authored and Adam Reif committed Mar 16, 2023
1 parent b6ae25c commit 25761ff
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pallets/parachain-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1689,12 +1689,13 @@ pub mod pallet {
.rev()
.filter(|x| {
// Only consider collators above minimum total stake and self-bond
x.amount >= T::MinCollatorStk::get()
&& Self::is_candidate(&x.owner)
&& Self::candidate_info(x.owner.clone())
.expect("is_candidate => canidateinfo exists. qed")
.bond
>= T::MinCandidateStk::get()
x.amount >= T::MinCollatorStk::get() &&
if let Some(info) = Self::candidate_info(x.owner.clone()) {
info.bond >= T::MinCandidateStk::get()
} else {
log::error!("Candidate did not have CandidateInfo in storage, this should not happen");
false
}
})
.take(top_n)
.map(|x| x.owner)
Expand Down

0 comments on commit 25761ff

Please sign in to comment.