diff --git a/coins/monero/src/serialize.rs b/coins/monero/src/serialize.rs index 5f0840f6..9f41bf50 100644 --- a/coins/monero/src/serialize.rs +++ b/coins/monero/src/serialize.rs @@ -110,7 +110,10 @@ pub(crate) fn read_point(r: &mut R) -> io::Result { } pub(crate) fn read_torsion_free_point(r: &mut R) -> io::Result { - read_point(r).ok().filter(|point| point.is_torsion_free()).ok_or(io::Error::new(io::ErrorKind::Other, "invalid point")) + read_point(r) + .ok() + .filter(|point| point.is_torsion_free()) + .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "invalid point")) } pub(crate) fn read_raw_vec io::Result>(