chain: Update the note about time truncation

This commit is contained in:
teor 2020-06-22 10:17:34 +10:00
parent f40bfff7c0
commit a9efb8715e
1 changed files with 2 additions and 1 deletions

View File

@ -146,7 +146,8 @@ impl ZcashSerialize for BlockHeader {
writer.write_all(&self.merkle_root_hash.0[..])?;
writer.write_all(&self.final_sapling_root_hash.0[..])?;
// this is a truncating cast, rather than a saturating cast
// but u32 times are valid until 2106
// but u32 times are valid until 2106, and our block verification time
// checks should detect any truncation.
writer.write_u32::<LittleEndian>(self.time.timestamp() as u32)?;
writer.write_u32::<LittleEndian>(self.bits)?;
writer.write_all(&self.nonce[..])?;