From c8ba44b0b5566f60190e232941b8161d74a9e4de Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sat, 1 Jun 2019 12:56:35 +1000 Subject: [PATCH] Create db-level alias for genesis block --- beacon_node/beacon_chain/src/beacon_chain.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index bac8f74a7..e0e3ffd4d 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -127,6 +127,14 @@ impl BeaconChain { 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,