Skip to content

Commit

Permalink
add missing UnfinishedBlock and SubEpochSummary types
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Oct 18, 2023
1 parent 063857a commit ca560bb
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
4 changes: 4 additions & 0 deletions chia-protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ pub mod proof_of_space;
pub mod reward_chain_block;
pub mod slots;
pub mod spend_bundle;
pub mod sub_epoch_summary;
pub mod unfinished_block;
pub mod vdf;
pub mod wallet_protocol;
pub mod weight_proof;
Expand All @@ -38,6 +40,8 @@ pub use crate::proof_of_space::*;
pub use crate::reward_chain_block::*;
pub use crate::slots::*;
pub use crate::spend_bundle::*;
pub use crate::sub_epoch_summary::*;
pub use crate::unfinished_block::*;
pub use crate::vdf::*;
pub use crate::wallet_protocol::*;
pub use crate::weight_proof::*;
11 changes: 11 additions & 0 deletions chia-protocol/src/sub_epoch_summary.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use crate::streamable_struct;
use crate::Bytes32;
use chia_streamable_macro::Streamable;

streamable_struct!(SubEpochSummary {
prev_subepoch_summary_hash: Bytes32,
reward_chain_hash: Bytes32, // hash of reward chain at end of last segment
num_blocks_overflow: u8, // How many more blocks than 384*(N-1)
new_difficulty: Option<u64>, // Only once per epoch (diff adjustment)
new_sub_slot_iters: Option<u64>, // Only once per epoch (diff adjustment)
});
21 changes: 21 additions & 0 deletions chia-protocol/src/unfinished_block.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use chia_streamable_macro::Streamable;

use crate::streamable_struct;
use crate::EndOfSubSlotBundle;
use crate::Program;
use crate::RewardChainBlockUnfinished;
use crate::VDFProof;
use crate::{Foliage, FoliageTransactionBlock, TransactionsInfo};

streamable_struct! (UnfinishedBlock {
// Full block, without the final VDFs
finished_sub_slots: Vec<EndOfSubSlotBundle>, // If first sb
reward_chain_block: RewardChainBlockUnfinished, // Reward chain trunk data
challenge_chain_sp_proof: Option<VDFProof>, // If not first sp in sub-slot
reward_chain_sp_proof: Option<VDFProof>, // If not first sp in sub-slot
foliage: Foliage, // Reward chain foliage data
foliage_transaction_block: Option<FoliageTransactionBlock>, // Reward chain foliage data (tx block)
transactions_info: Option<TransactionsInfo>, // Reward chain foliage data (tx block additional)
transactions_generator: Option<Program>, // Program that generates transactions
transactions_generator_ref_list: Vec<u32>, // List of block heights of previous generators referenced in this block
});
6 changes: 4 additions & 2 deletions wheel/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ use chia_protocol::{
RespondChildren, RespondFeeEstimates, RespondHeaderBlocks, RespondPuzzleSolution,
RespondRemovals, RespondSesInfo, RespondToCoinUpdates, RespondToPhUpdates, RewardChainBlock,
RewardChainBlockUnfinished, RewardChainSubSlot, SendTransaction, SpendBundle,
SubEpochChallengeSegment, SubEpochSegments, SubSlotData, SubSlotProofs, TransactionAck,
TransactionsInfo, VDFInfo, VDFProof,
SubEpochChallengeSegment, SubEpochSegments, SubEpochSummary, SubSlotData, SubSlotProofs,
TransactionAck, TransactionsInfo, UnfinishedBlock, VDFInfo, VDFProof,
};
use clvmr::serde::tree_hash_from_stream;
use clvmr::{
Expand Down Expand Up @@ -329,6 +329,8 @@ pub fn chia_rs(py: Python, m: &PyModule) -> PyResult<()> {
m.add_class::<SubSlotData>()?;
m.add_class::<SubEpochChallengeSegment>()?;
m.add_class::<SubEpochSegments>()?;
m.add_class::<SubEpochSummary>()?;
m.add_class::<UnfinishedBlock>()?;

// wallet protocol
m.add_class::<RequestPuzzleSolution>()?;
Expand Down

0 comments on commit ca560bb

Please sign in to comment.