diff --git a/zebra-chain/src/block/arbitrary.rs b/zebra-chain/src/block/arbitrary.rs index 80c327f8d..731286060 100644 --- a/zebra-chain/src/block/arbitrary.rs +++ b/zebra-chain/src/block/arbitrary.rs @@ -472,11 +472,20 @@ impl Block { .unwrap(); let nu5_height = NetworkUpgrade::Nu5.activation_height(current.network); match current_height.cmp(&heartwood_height) { - std::cmp::Ordering::Less => {} + std::cmp::Ordering::Less => { + // In pre-Heartwood blocks this is the Sapling note commitment tree root. + // We don't validate it since we checkpoint on Canopy, but it + // needs to be well-formed, i.e. smaller than 𝑞_J, so we + // arbitrarily set it to 1. + block.header.commitment_bytes = [0u8; 32]; + block.header.commitment_bytes[0] = 1; + } std::cmp::Ordering::Equal => { + // The Heartwood activation block has a hardcoded all-zeroes commitment. block.header.commitment_bytes = [0u8; 32]; } std::cmp::Ordering::Greater => { + // Set the correct commitment bytes according to the network upgrade. let history_tree_root = match &history_tree { Some(tree) => tree.hash().unwrap_or_else(|| [0u8; 32].into()), None => [0u8; 32].into(),