chia_protocol/
foliage.rs

1use chia_streamable_macro::streamable;
2
3use crate::Bytes32;
4use crate::Coin;
5use crate::PoolTarget;
6use chia_bls::G2Element;
7
8#[streamable]
9pub struct TransactionsInfo {
10    // Information that goes along with each transaction block
11    generator_root: Bytes32, // sha256 of the block generator in this block
12    generator_refs_root: Bytes32, // sha256 of the concatenation of the generator ref list entries
13    aggregated_signature: G2Element,
14    fees: u64, // This only includes user fees, not block rewards
15    cost: u64, // This is the total cost of this block, including CLVM cost, cost of program size and conditions
16    reward_claims_incorporated: Vec<Coin>, // These can be in any order
17}
18
19#[streamable]
20pub struct FoliageTransactionBlock {
21    // Information that goes along with each transaction block that is relevant for light clients
22    prev_transaction_block_hash: Bytes32,
23    timestamp: u64,
24    filter_hash: Bytes32,
25    additions_root: Bytes32,
26    removals_root: Bytes32,
27    transactions_info_hash: Bytes32,
28}
29
30#[streamable]
31pub struct FoliageBlockData {
32    // Part of the block that is signed by the plot key
33    unfinished_reward_block_hash: Bytes32,
34    pool_target: PoolTarget,
35    pool_signature: Option<G2Element>, // Iff ProofOfSpace has a pool pk
36    farmer_reward_puzzle_hash: Bytes32,
37    extension_data: Bytes32, // Used for future updates. Can be any 32 byte value initially
38}
39
40#[streamable]
41pub struct Foliage {
42    // The entire foliage block, containing signature and the unsigned back pointer
43    // The hash of this is the "header hash". Note that for unfinished blocks, the prev_block_hash
44    // Is the prev from the signage point, and can be replaced with a more recent block
45    prev_block_hash: Bytes32,
46    reward_block_hash: Bytes32,
47    foliage_block_data: FoliageBlockData,
48    foliage_block_data_signature: G2Element,
49    foliage_transaction_block_hash: Option<Bytes32>,
50    foliage_transaction_block_signature: Option<G2Element>,
51}