Fix bug with per-block processing
This commit is contained in:
parent
71d95ee9db
commit
7503f31ddc
@ -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
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -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(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user