chia_protocol/
reward_chain_block.rs

1use chia_streamable_macro::streamable;
2
3use crate::Bytes32;
4use crate::ProofOfSpace;
5use crate::VDFInfo;
6use chia_bls::G2Element;
7
8#[cfg(feature = "py-bindings")]
9use pyo3::prelude::*;
10
11#[streamable]
12pub struct RewardChainBlockUnfinished {
13    total_iters: u128,
14    signage_point_index: u8,
15    pos_ss_cc_challenge_hash: Bytes32,
16    proof_of_space: ProofOfSpace,
17    challenge_chain_sp_vdf: Option<VDFInfo>, // Not present for first sp in slot
18    challenge_chain_sp_signature: G2Element,
19    reward_chain_sp_vdf: Option<VDFInfo>, // Not present for first sp in slot
20    reward_chain_sp_signature: G2Element,
21}
22
23#[streamable]
24pub struct RewardChainBlock {
25    weight: u128,
26    height: u32,
27    total_iters: u128,
28    signage_point_index: u8,
29    pos_ss_cc_challenge_hash: Bytes32,
30    proof_of_space: ProofOfSpace,
31    challenge_chain_sp_vdf: Option<VDFInfo>, // Not present for first sp in slot
32    challenge_chain_sp_signature: G2Element,
33    challenge_chain_ip_vdf: VDFInfo,
34    reward_chain_sp_vdf: Option<VDFInfo>, // Not present for first sp in slot
35    reward_chain_sp_signature: G2Element,
36    reward_chain_ip_vdf: VDFInfo,
37    infused_challenge_chain_ip_vdf: Option<VDFInfo>, // Iff deficit < 16
38    is_transaction_block: bool,
39}
40
41#[cfg_attr(feature = "py-bindings", pymethods)]
42impl RewardChainBlock {
43    pub fn get_unfinished(&self) -> RewardChainBlockUnfinished {
44        RewardChainBlockUnfinished {
45            total_iters: self.total_iters,
46            signage_point_index: self.signage_point_index,
47            pos_ss_cc_challenge_hash: self.pos_ss_cc_challenge_hash,
48            proof_of_space: self.proof_of_space.clone(),
49            challenge_chain_sp_vdf: self.challenge_chain_sp_vdf.clone(),
50            challenge_chain_sp_signature: self.challenge_chain_sp_signature.clone(),
51            reward_chain_sp_vdf: self.reward_chain_sp_vdf.clone(),
52            reward_chain_sp_signature: self.reward_chain_sp_signature.clone(),
53        }
54    }
55}