mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Add asserts to ensure block heights are not too large.
This commit is contained in:
@@ -25,12 +25,14 @@ macro_rules! impl_into_u32 {
|
||||
($main: ident) => {
|
||||
impl Into<u32> for $main {
|
||||
fn into(self) -> u32 {
|
||||
assert!(self.0 < u64::from(std::u32::MAX), "Lossy conversion to u32");
|
||||
self.0 as u32
|
||||
}
|
||||
}
|
||||
|
||||
impl $main {
|
||||
pub fn as_u32(&self) -> u32 {
|
||||
assert!(self.0 < u64::from(std::u32::MAX), "Lossy conversion to u32");
|
||||
self.0 as u32
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user