Fix signed_root vs tree_hash_root in per_slot

This commit is contained in:
Michael Sproul 2019-04-17 11:59:40 +10:00
parent 701cc00d08
commit f592183aa9
No known key found for this signature in database
GPG Key ID: 77B1309D2E54E914

View File

@ -1,5 +1,5 @@
use crate::*;
use tree_hash::TreeHash;
use tree_hash::{SignedRoot, TreeHash};
use types::*;
#[derive(Debug, PartialEq)]
@ -38,7 +38,7 @@ fn cache_state(state: &mut BeaconState, spec: &ChainSpec) -> Result<(), Error> {
state.latest_block_header.state_root = previous_slot_state_root
}
let latest_block_root = Hash256::from_slice(&state.latest_block_header.tree_hash_root()[..]);
let latest_block_root = Hash256::from_slice(&state.latest_block_header.signed_root()[..]);
state.set_block_root(previous_slot, latest_block_root, spec)?;
// Set the state slot back to what it should be.