add cli for --accounts-hash-num-passes (#20827)

This commit is contained in:
Jeff Washington (jwash)
2021-10-25 09:45:46 -05:00
committed by GitHub
parent e03dc9e8e3
commit 43ea579f63
5 changed files with 76 additions and 26 deletions

View File

@ -237,16 +237,16 @@ where
is_parsable_generic::<Slot, _>(slot)
}
pub fn is_bin<T>(bins: T) -> Result<(), String>
pub fn is_pow2<T>(bins: T) -> Result<(), String>
where
T: AsRef<str> + Display,
{
bins.as_ref()
.parse::<usize>()
.map_err(|e| format!("Unable to parse bins, provided: {}, err: {}", bins, e))
.map_err(|e| format!("Unable to parse, provided: {}, err: {}", bins, e))
.and_then(|v| {
if !v.is_power_of_two() {
Err(format!("Bins must be a power of 2: {}", v))
Err(format!("Must be a power of 2: {}", v))
} else {
Ok(())
}