Update AttestationData struct
This commit is contained in:
parent
1e3fd1ff80
commit
6e0daec1da
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user