From 6e0daec1da81fa5b2f1a5b2752fc3376e8a54761 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Tue, 4 Dec 2018 14:50:32 +1100 Subject: [PATCH] Update AttestationData struct --- beacon_chain/types/src/attestation_data.rs | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/beacon_chain/types/src/attestation_data.rs b/beacon_chain/types/src/attestation_data.rs index f0e7ea4c2..0e87ace6a 100644 --- a/beacon_chain/types/src/attestation_data.rs +++ b/beacon_chain/types/src/attestation_data.rs @@ -1,6 +1,17 @@ use super::ssz::{Decodable, DecodeError, Encodable, SszStream}; use super::Hash256; +pub const SSZ_ATTESTION_DATA_LENGTH: usize = { + 8 + // slot + 8 + // shard + 32 + // beacon_block_hash + 32 + // epoch_boundary_hash + 32 + // shard_block_hash + 32 + // latest_crosslink_hash + 8 + // justified_slot + 32 // justified_block_hash +}; + #[derive(Debug, Clone, PartialEq)] pub struct AttestationData { pub slot: u64, @@ -13,6 +24,21 @@ pub struct AttestationData { pub justified_block_hash: Hash256, } +impl AttestationData { + pub fn zero() -> Self { + Self { + slot: 0, + shard: 0, + beacon_block_hash: Hash256::zero(), + epoch_boundary_hash: Hash256::zero(), + shard_block_hash: Hash256::zero(), + latest_crosslink_hash: Hash256::zero(), + justified_slot: 0, + justified_block_hash: Hash256::zero(), + } + } +} + impl Encodable for AttestationData { fn ssz_append(&self, s: &mut SszStream) { s.append(&self.slot);