Fix bug with per-block processing

This commit is contained in:
Paul Hauner 2019-03-18 18:09:31 +11:00
parent 71d95ee9db
commit 7503f31ddc
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6
2 changed files with 4 additions and 4 deletions

View File

@ -100,8 +100,11 @@ pub fn process_block_header(
) -> Result<(), Error> { ) -> Result<(), Error> {
verify!(block.slot == state.slot, Invalid::StateSlotMismatch); verify!(block.slot == state.slot, Invalid::StateSlotMismatch);
// NOTE: this is not to spec. I think spec is broken. See:
//
// https://github.com/ethereum/eth2.0-specs/issues/797
verify!( verify!(
block.previous_block_root.as_bytes() == &state.latest_block_header.hash_tree_root()[..], block.previous_block_root == *state.get_block_root(state.slot - 1, spec)?,
Invalid::ParentBlockRootMismatch Invalid::ParentBlockRootMismatch
); );

View File

@ -25,9 +25,6 @@ pub fn per_slot_processing(
state.slot += 1; state.slot += 1;
let latest_block_root = Hash256::from_slice(&state.latest_block_header.hash_tree_root()[..]);
state.set_block_root(state.slot - 1, latest_block_root, spec)?;
Ok(()) Ok(())
} }