Ensure tze digest is only included if TZEs are in the consensus rules.

This commit is contained in:
Kris Nuttycombe 2021-06-08 11:33:52 -06:00
parent acc19a76e2
commit 31ea91ced8
1 changed files with 6 additions and 7 deletions

View File

@ -572,13 +572,7 @@ impl TransactionDigest<Authorized> for BlockTxCommitmentDigester {
orchard_digest: Self::OrchardDigest,
#[cfg(feature = "zfuture")] tze_digest: Self::TzeDigest,
) -> Self::Digest {
let digests = [
transparent_digest,
sapling_digest,
orchard_digest,
#[cfg(feature = "zfuture")]
tze_digest,
];
let digests = [transparent_digest, sapling_digest, orchard_digest];
let mut personal = [0; 16];
(&mut personal[..12]).copy_from_slice(ZCASH_AUTH_PERSONALIZATION_PREFIX);
@ -591,6 +585,11 @@ impl TransactionDigest<Authorized> for BlockTxCommitmentDigester {
h.write_all(digest.as_bytes()).unwrap();
}
#[cfg(feature = "zfuture")]
if TxVersion::suggested_for_branch(consensus_branch_id).has_tze() {
h.write_all(tze_digest.as_bytes()).unwrap();
}
h.finalize()
}
}