diff --git a/chia-protocol/src/reward_chain_block.rs b/chia-protocol/src/reward_chain_block.rs index d1b13d19f..89e0f75bb 100644 --- a/chia-protocol/src/reward_chain_block.rs +++ b/chia-protocol/src/reward_chain_block.rs @@ -6,6 +6,9 @@ use crate::ProofOfSpace; use crate::VDFInfo; use chia_bls::G2Element; +#[cfg(feature = "py-bindings")] +use pyo3::prelude::*; + streamable_struct! (RewardChainBlockUnfinished { total_iters: u128, signage_point_index: u8, @@ -33,3 +36,19 @@ streamable_struct! (RewardChainBlock { infused_challenge_chain_ip_vdf: Option, // Iff deficit < 16 is_transaction_block: bool, }); + +#[cfg_attr(feature = "py-bindings", pymethods)] +impl RewardChainBlock { + pub fn get_unfinished(&self) -> RewardChainBlockUnfinished { + RewardChainBlockUnfinished { + total_iters: self.total_iters, + signage_point_index: self.signage_point_index, + pos_ss_cc_challenge_hash: self.pos_ss_cc_challenge_hash, + proof_of_space: self.proof_of_space.clone(), + challenge_chain_sp_vdf: self.challenge_chain_sp_vdf.clone(), + challenge_chain_sp_signature: self.challenge_chain_sp_signature.clone(), + reward_chain_sp_vdf: self.reward_chain_sp_vdf.clone(), + reward_chain_sp_signature: self.reward_chain_sp_signature.clone(), + } + } +} diff --git a/wheel/chia_rs.pyi b/wheel/chia_rs.pyi index 55f0b9450..5ec44994c 100644 --- a/wheel/chia_rs.pyi +++ b/wheel/chia_rs.pyi @@ -922,6 +922,7 @@ class RewardChainBlock: reward_chain_ip_vdf: VDFInfo infused_challenge_chain_ip_vdf: Optional[VDFInfo] is_transaction_block: bool + def get_unfinished(self) -> RewardChainBlockUnfinished: ... def __init__( self, weight: int, diff --git a/wheel/generate_type_stubs.py b/wheel/generate_type_stubs.py index 0ec0bca1a..c452cd4b5 100644 --- a/wheel/generate_type_stubs.py +++ b/wheel/generate_type_stubs.py @@ -164,6 +164,9 @@ def parse_rust_source(filename: str) -> List[Tuple[str, List[str]]]: "def get_included_reward_coins(self) -> List[Coin]: ...", "def is_fully_compactified(self) -> bool: ...", ], + "RewardChainBlock": [ + "def get_unfinished(self) -> RewardChainBlockUnfinished: ...", + ], } classes = []