Update ActiveState as per new spec

This commit is contained in:
Paul Hauner 2018-10-20 17:15:36 +11:00
parent 073e3529e9
commit de8b84f9cd
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C

View File

@ -1,30 +1,12 @@
use super::Hash256; use super::Hash256;
use super::attestation_record::AttestationRecord; use super::{
AttestationRecord,
SpecialRecord,
};
pub struct ActiveState { pub struct ActiveState {
pub pending_attestations: Vec<AttestationRecord>, pub pending_attestations: Vec<AttestationRecord>,
pub pending_specials: Vec<SpecialRecord>,
pub recent_block_hashes: Vec<Hash256>, pub recent_block_hashes: Vec<Hash256>,
} pub randao_mix: Hash256,
impl ActiveState {
/// Returns a new instance where all fields are empty vectors.
pub fn zero() -> Self {
Self {
pending_attestations: vec![],
recent_block_hashes: vec![],
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_act_state_zero() {
let a = ActiveState::zero();
assert_eq!(a.pending_attestations.len(), 0);
assert_eq!(a.recent_block_hashes.len(), 0);
}
} }