Tidy get_attesters_and_proposers
This commit is contained in:
parent
e3005efb3d
commit
ac0546baa0
@ -41,14 +41,29 @@ pub fn get_attesters_and_proposer(
|
|||||||
+ (*skip_count as usize) + proposer_count;
|
+ (*skip_count as usize) + proposer_count;
|
||||||
assert!(ideal_validator_count >= 2,
|
assert!(ideal_validator_count >= 2,
|
||||||
"ideal_validator_count must be >=2");
|
"ideal_validator_count must be >=2");
|
||||||
if ideal_validator_count > active_validator_count {
|
/*
|
||||||
return (
|
* If there are adequate validators to allocate a full set of assesters and
|
||||||
shuffled_validator_indicies[0..active_validator_count - 1].to_vec(),
|
* a proposer, then do so. Otherwise, the amount of attesters will need to be
|
||||||
shuffled_validator_indicies[active_validator_count - 1]);
|
* validator_count - 1.
|
||||||
} else {
|
*/
|
||||||
return (
|
match ideal_validator_count > active_validator_count {
|
||||||
shuffled_validator_indicies[0..ideal_validator_count - 1].to_vec(),
|
true => {
|
||||||
shuffled_validator_indicies[ideal_validator_count - 1]);
|
/*
|
||||||
|
* The active validator count is too low.
|
||||||
|
*/
|
||||||
|
warn!(log, "active validator count is low";
|
||||||
|
"active_validator_count" => active_validator_count,
|
||||||
|
"ideal_validator_count" => ideal_validator_count);
|
||||||
|
(shuffled_validator_indicies[0..active_validator_count - 1].to_vec(),
|
||||||
|
shuffled_validator_indicies[active_validator_count - 1])
|
||||||
|
}
|
||||||
|
false => {
|
||||||
|
/*
|
||||||
|
* The active validator count is adequate.
|
||||||
|
*/
|
||||||
|
(shuffled_validator_indicies[0..ideal_validator_count - 1].to_vec(),
|
||||||
|
shuffled_validator_indicies[ideal_validator_count - 1])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user