-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Reduce log spam with will not infuse block. #19069
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,6 +240,13 @@ def get_height(self) -> uint32: | |
else: | ||
return uint32(self.last_state.get_height() + 1) | ||
|
||
def _get_rc_cache_index(self, block: timelord_protocol.NewUnfinishedBlockTimelord) -> Optional[int]: | ||
for index, (rc, _) in enumerate(self.last_state.reward_challenge_cache): | ||
if rc == block.rc_prev: | ||
return index | ||
|
||
return None | ||
|
||
def _can_infuse_unfinished_block(self, block: timelord_protocol.NewUnfinishedBlockTimelord) -> Optional[uint64]: | ||
assert self.last_state is not None | ||
sub_slot_iters = self.last_state.get_sub_slot_iters() | ||
|
@@ -260,12 +267,9 @@ def _can_infuse_unfinished_block(self, block: timelord_protocol.NewUnfinishedBlo | |
block_sp_total_iters = self.last_state.total_iters - ip_iters + block_sp_iters | ||
if is_overflow_block(self.constants, block.reward_chain_block.signage_point_index): | ||
block_sp_total_iters -= self.last_state.get_sub_slot_iters() | ||
found_index = -1 | ||
for index, (rc, total_iters) in enumerate(self.last_state.reward_challenge_cache): | ||
if rc == block.rc_prev: | ||
found_index = index | ||
break | ||
if found_index == -1: | ||
|
||
found_index = self._get_rc_cache_index(block) | ||
if found_index is None: | ||
log.warning(f"Will not infuse {block.rc_prev} because its reward chain challenge is not in the chain") | ||
return None | ||
if ip_iters > block_ip_iters: | ||
|
@@ -337,6 +341,8 @@ async def _reset_chains(self, *, first_run: bool = False, only_eos: bool = False | |
self.iteration_to_proof_type[new_block_iters] = IterationType.INFUSION_POINT | ||
# Remove all unfinished blocks that have already passed. | ||
self.unfinished_blocks = new_unfinished_blocks | ||
# Remove old overflow blocks that we didn't infuse. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we clean all the blocks we cant infuse in the loop above but we dont clean the blocks that we moved from self.overflow_blocks to the new_unfinished i think just adding to line 337 would be a better solution, also it looks like we currently duplicate blocks in both self.unfinished and self.overflow_blocks in the loop above |
||
self.overflow_blocks = [block for block in self.overflow_blocks if self._get_rc_cache_index(block) is not None] | ||
# Signage points. | ||
if not only_eos and len(self.signage_point_iters) > 0: | ||
count_signage = 0 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing line 271