zebra_rpc/methods/types/default_roots.rs
1//! The `DefaultRoots` type is part of the `getblocktemplate` RPC method output.
2
3use zebra_chain::block::{
4 merkle::{self, AuthDataRoot},
5 ChainHistoryBlockTxAuthCommitmentHash, ChainHistoryMmrRootHash,
6};
7
8/// The block header roots for [`GetBlockTemplate.transactions`].
9///
10/// If the transactions in the block template are modified, these roots must be recalculated
11/// [according to the specification](https://zcash.github.io/rpc/getblocktemplate.html).
12#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
13pub struct DefaultRoots {
14 /// The merkle root of the transaction IDs in the block.
15 /// Used in the new block's header.
16 #[serde(rename = "merkleroot")]
17 #[serde(with = "hex")]
18 pub merkle_root: merkle::Root,
19
20 /// The root of the merkle mountain range of the chain history roots from the last network upgrade to the previous block.
21 /// Unlike the other roots, this not cover any data from this new block, only from previous blocks.
22 #[serde(rename = "chainhistoryroot")]
23 #[serde(with = "hex")]
24 pub chain_history_root: ChainHistoryMmrRootHash,
25
26 /// The merkle root of the authorizing data hashes of the transactions in the new block.
27 #[serde(rename = "authdataroot")]
28 #[serde(with = "hex")]
29 pub auth_data_root: AuthDataRoot,
30
31 /// The block commitment for the new block's header.
32 /// This hash covers `chain_history_root` and `auth_data_root`.
33 ///
34 /// `merkle_root` has its own field in the block header.
35 #[serde(rename = "blockcommitmentshash")]
36 #[serde(with = "hex")]
37 pub block_commitments_hash: ChainHistoryBlockTxAuthCommitmentHash,
38}