Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add member functions to SubSlotData #287

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions chia-protocol/src/weight_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ streamable_struct! (SubSlotData {
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>,
Expand Down
2 changes: 2 additions & 0 deletions wheel/chia_rs.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2106,6 +2106,8 @@ class SubSlotData:
cc_ip_vdf_info: Optional[VDFInfo]
icc_ip_vdf_info: Optional[VDFInfo]
total_iters: Optional[int]
def is_end_of_slot(self) -> bool: ...
def is_challenge(self) -> bool: ...
def __init__(
self,
proof_of_space: Optional[ProofOfSpace],
Expand Down
4 changes: 4 additions & 0 deletions wheel/generate_type_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ def parse_rust_source(filename: str) -> List[Tuple[str, List[str]]]:
"RewardChainBlock": [
"def get_unfinished(self) -> RewardChainBlockUnfinished: ...",
],
"SubSlotData": [
"def is_end_of_slot(self) -> bool: ...",
"def is_challenge(self) -> bool: ...",
],
}

classes = []
Expand Down
Loading