lighthouse-pulse/lighthouse/state/crosslink_record.rs

30 lines
560 B
Rust
Raw Normal View History

2018-08-10 00:48:03 +00:00
use super::utils::types::Hash256;
2018-07-06 07:54:07 +00:00
2018-08-10 00:48:03 +00:00
#[derive(Clone)]
2018-07-06 07:54:07 +00:00
pub struct CrosslinkRecord {
2018-08-10 00:48:03 +00:00
pub dynasty: u64,
pub hash: Hash256,
2018-07-06 07:54:07 +00:00
}
impl CrosslinkRecord {
2018-08-10 00:48:03 +00:00
/// Generates a new instance where `dynasty` and `hash` are both zero.
pub fn zero() -> Self {
Self {
dynasty: 0,
hash: Hash256::zero(),
2018-07-06 07:54:07 +00:00
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
2018-08-10 00:48:03 +00:00
fn test_crosslink_record_zero() {
let c = CrosslinkRecord::zero();
assert_eq!(c.dynasty, 0);
assert!(c.hash.is_zero());
2018-07-09 06:18:56 +00:00
}
2018-07-06 07:54:07 +00:00
}