From 493a16ac182f72443a1d3301dd055f3e5adc6e05 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Thu, 13 Dec 2018 17:33:16 +1100 Subject: [PATCH] Update attestation_validator for spec updates --- beacon_chain/attestation_validation/src/justified_slot.rs | 3 ++- beacon_chain/attestation_validation/src/shard_block.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/beacon_chain/attestation_validation/src/justified_slot.rs b/beacon_chain/attestation_validation/src/justified_slot.rs index c27dfe8f2..ea71f2616 100644 --- a/beacon_chain/attestation_validation/src/justified_slot.rs +++ b/beacon_chain/attestation_validation/src/justified_slot.rs @@ -12,8 +12,9 @@ use super::{Error, Invalid, Outcome}; pub fn validate_attestation_justified_slot( data: &AttestationData, state: &BeaconState, + epoch_length: u64, ) -> Result { - let permissable_justified_slot = if data.slot >= state.latest_state_recalculation_slot { + let permissable_justified_slot = if data.slot >= state.slot - (state.slot % epoch_length) { state.justified_slot } else { state.previous_justified_slot diff --git a/beacon_chain/attestation_validation/src/shard_block.rs b/beacon_chain/attestation_validation/src/shard_block.rs index 7fb48ff62..e1d9487de 100644 --- a/beacon_chain/attestation_validation/src/shard_block.rs +++ b/beacon_chain/attestation_validation/src/shard_block.rs @@ -19,7 +19,7 @@ where match state.latest_crosslinks.get(data.shard as usize) { None => reject!(Invalid::UnknownShard), Some(crosslink) => { - let local_shard_block_hash = crosslink.shard_block_hash; + let local_shard_block_hash = crosslink.shard_block_root; let shard_block_hash_is_permissable = { (local_shard_block_hash == data.latest_crosslink_hash) || (local_shard_block_hash == data.shard_block_hash)