fix: Rename the light client hash field
This commit is contained in:
parent
faac50697c
commit
53ce01fd23
|
@ -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).
|
||||
|
|
|
@ -18,7 +18,7 @@ impl ZcashSerialize for BlockHeader {
|
|||
writer.write_u32::<LittleEndian>(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::<LittleEndian>()? as i64, 0),
|
||||
difficulty_threshold: CompactDifficulty(reader.read_u32::<LittleEndian>()?),
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue