diff --git a/zebra-chain/src/block/header.rs b/zebra-chain/src/block/header.rs index 2e87db349..473982b58 100644 --- a/zebra-chain/src/block/header.rs +++ b/zebra-chain/src/block/header.rs @@ -38,15 +38,12 @@ pub struct BlockHeader { /// [Sapling and Blossom] The root LEBS2OSP256(rt) of the Sapling note /// commitment tree corresponding to the final Sapling treestate of /// this block. - /// [Heartwood onward] The root of a Merkle Mountain Range tree, which - /// commits to various features of the chain's history, including the - /// Sapling commitment tree. This commitment supports the FlyClient - /// protocol. See ZIP-221 for details. - // TODO: - // - replace with an unspecified HistoryRootHash type? - // Note that the NetworkUpgrade list is in zebra-consensus, so we can't - // parse this field into a HistoryRootHash enum in zebra-chain. - pub history_root_hash: [u8; 32], + /// [Heartwood activation block] All zeroes. See ZIP-221 for details. + /// [After Heartwood activation block] The root of a Merkle Mountain + /// Range tree, which commits to various features of the chain's + /// history, including the Sapling commitment tree. This commitment + /// supports the FlyClient protocol. See ZIP-221 for details. + pub light_client_root_hash: [u8; 32], /// The block timestamp is a Unix epoch time (UTC) when the miner /// started hashing the header (according to the miner). diff --git a/zebra-chain/src/block/serialize.rs b/zebra-chain/src/block/serialize.rs index 2824b9e21..23c7c28b4 100644 --- a/zebra-chain/src/block/serialize.rs +++ b/zebra-chain/src/block/serialize.rs @@ -18,7 +18,7 @@ impl ZcashSerialize for BlockHeader { writer.write_u32::(self.version)?; self.previous_block_hash.zcash_serialize(&mut writer)?; writer.write_all(&self.merkle_root_hash.0[..])?; - writer.write_all(&self.history_root_hash[..])?; + writer.write_all(&self.light_client_root_hash[..])?; // this is a truncating cast, rather than a saturating cast // but u32 times are valid until 2106, and our block verification time // checks should detect any truncation. @@ -66,7 +66,7 @@ impl ZcashDeserialize for BlockHeader { version, previous_block_hash: BlockHeaderHash::zcash_deserialize(&mut reader)?, merkle_root_hash: MerkleTreeRootHash(reader.read_32_bytes()?), - history_root_hash: reader.read_32_bytes()?, + light_client_root_hash: reader.read_32_bytes()?, // This can't panic, because all u32 values are valid `Utc.timestamp`s time: Utc.timestamp(reader.read_u32::()? as i64, 0), difficulty_threshold: CompactDifficulty(reader.read_u32::()?), diff --git a/zebra-chain/src/block/tests.rs b/zebra-chain/src/block/tests.rs index df708aeec..589eedfa2 100644 --- a/zebra-chain/src/block/tests.rs +++ b/zebra-chain/src/block/tests.rs @@ -39,7 +39,7 @@ impl Arbitrary for BlockHeader { version, previous_block_hash, merkle_root_hash, - history_root_hash, + light_client_root_hash, timestamp, difficulty_threshold, nonce, @@ -48,7 +48,7 @@ impl Arbitrary for BlockHeader { version, previous_block_hash, merkle_root_hash, - history_root_hash, + light_client_root_hash, time: Utc.timestamp(timestamp, 0), difficulty_threshold, nonce,