mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Use a do-while in multiexp, first to please a friend, and then to annoy them
It's also legitimately cleaner code.
This commit is contained in:
@@ -22,11 +22,12 @@ impl<Id: Copy, G: Group> BatchVerifier<Id, G> where <G as Group>::Scalar: PrimeF
|
|||||||
let u = if self.0.len() == 0 {
|
let u = if self.0.len() == 0 {
|
||||||
G::Scalar::one()
|
G::Scalar::one()
|
||||||
} else {
|
} else {
|
||||||
let mut weight = G::Scalar::random(&mut *rng);
|
let mut weight;
|
||||||
// Ensure it's non-zero, as a zero scalar would cause this item to pass no matter what
|
// Ensure it's non-zero, as a zero scalar would cause this item to pass no matter what
|
||||||
while weight.is_zero().into() {
|
while {
|
||||||
weight = G::Scalar::random(&mut *rng);
|
weight = G::Scalar::random(&mut *rng);
|
||||||
}
|
weight.is_zero().into()
|
||||||
|
} {}
|
||||||
weight
|
weight
|
||||||
};
|
};
|
||||||
self.0.push((id, pairs.into_iter().map(|(scalar, point)| (scalar * u, point)).collect()));
|
self.0.push((id, pairs.into_iter().map(|(scalar, point)| (scalar * u, point)).collect()));
|
||||||
|
|||||||
Reference in New Issue
Block a user