Create db-level alias for genesis block

This commit is contained in:
Paul Hauner 2019-06-01 12:56:35 +10:00
parent 8831db1e0f
commit c8ba44b0b5
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C

View File

@ -127,6 +127,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
let block_root = genesis_block.block_header().canonical_root();
store.put(&block_root, &genesis_block)?;
// Store the genesis block under the `0x00..00` hash too.
//
// The spec declares that for fork choice, the `ZERO_HASH` should alias to the genesis
// block. See:
//
// github.com/ethereum/eth2.0-specs/blob/dev/specs/core/0_fork-choice.md#implementation-notes
store.put(&spec.zero_hash, &genesis_block)?;
let canonical_head = RwLock::new(CheckPoint::new(
genesis_block.clone(),
block_root,