use crate::streamable_struct;
use chik_streamable_macro::Streamable;
use crate::Bytes32;
use crate::EndOfSubSlotBundle;
use crate::HeaderBlock;
use crate::ProofOfSpace;
use crate::RewardChainBlock;
use crate::{VDFInfo, VDFProof};
streamable_struct! (SubEpochData {
reward_chain_hash: Bytes32,
num_blocks_overflow: u8,
new_sub_slot_iters: Option<u64>,
new_difficulty: Option<u64>,
});
streamable_struct! (SubSlotData {
proof_of_space: Option<ProofOfSpace>,
cc_signage_point: Option<VDFProof>,
cc_infusion_point: Option<VDFProof>,
icc_infusion_point: Option<VDFProof>,
cc_sp_vdf_info: Option<VDFInfo>,
signage_point_index: Option<u8>,
cc_slot_end: Option<VDFProof>,
icc_slot_end: Option<VDFProof>,
cc_slot_end_info: Option<VDFInfo>,
icc_slot_end_info: Option<VDFInfo>,
cc_ip_vdf_info: Option<VDFInfo>,
icc_ip_vdf_info: Option<VDFInfo>,
total_iters: Option<u128>,
});
#[cfg(feature = "py-bindings")]
use pyo3::prelude::*;
#[cfg_attr(feature = "py-bindings", pymethods)]
impl SubSlotData {
pub fn is_end_of_slot(&self) -> bool {
self.cc_slot_end_info.is_some()
}
pub fn is_challenge(&self) -> bool {
self.proof_of_space.is_some()
}
}
streamable_struct! (SubEpochChallengeSegment {
sub_epoch_n: u32,
sub_slots: Vec<SubSlotData>,
rc_slot_end_info: Option<VDFInfo>,
});
streamable_struct! (SubEpochSegments {
challenge_segments: Vec<SubEpochChallengeSegment>,
});
streamable_struct! (RecentChainData {
recent_chain_data: Vec<HeaderBlock>,
});
streamable_struct! (ProofBlockHeader {
finished_sub_slots: Vec<EndOfSubSlotBundle>,
reward_chain_block: RewardChainBlock,
});
streamable_struct! (WeightProof {
sub_epochs: Vec<SubEpochData>,
sub_epoch_segments: Vec<SubEpochChallengeSegment>, recent_chain_data: Vec<HeaderBlock>,
});