mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-26 01:03:40 +00:00
Initial commit
This commit is contained in:
29
src/state/crosslink_record.rs
Normal file
29
src/state/crosslink_record.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use super::utils::types::Sha256Digest;
|
||||
|
||||
pub struct CrosslinkRecord {
|
||||
pub epoch: u64,
|
||||
pub hash: Sha256Digest
|
||||
}
|
||||
|
||||
impl CrosslinkRecord {
|
||||
pub fn new(epoch: u64, hash: Sha256Digest) -> CrosslinkRecord {
|
||||
CrosslinkRecord {
|
||||
epoch: epoch,
|
||||
hash: hash
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_new() {
|
||||
let epoch = 1;
|
||||
let hash = Sha256Digest::random();
|
||||
let c = CrosslinkRecord::new(epoch, hash);
|
||||
assert_eq!(c.epoch, epoch);
|
||||
assert_eq!(c.hash, hash);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user