Skip to content

Commit

Permalink
Ms.double count (Chia-Network#1734)
Browse files Browse the repository at this point in the history
* Found the source of the counting issue. An overflow block which is not the first
  • Loading branch information
mariano54 authored Apr 7, 2021
1 parent 07a6ba5 commit bee0a42
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions chia/timelord/timelord.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ async def _reset_chains(self, first_run=False, only_eos=False):
new_block_iters: Optional[uint64] = self._can_infuse_unfinished_block(block)
# Does not add duplicates, or blocks that we cannot infuse
if new_block_iters and new_block_iters not in self.iters_to_submit[Chain.CHALLENGE_CHAIN]:
if block not in self.unfinished_blocks:
self.total_unfinished += 1
new_unfinished_blocks.append(block)
for chain in [Chain.REWARD_CHAIN, Chain.CHALLENGE_CHAIN]:
self.iters_to_submit[chain].append(new_block_iters)
Expand Down Expand Up @@ -289,6 +291,8 @@ async def _handle_new_peak(self):
for block in remove_unfinished:
if block in self.unfinished_blocks:
self.unfinished_blocks.remove(block)
if block in self.overflow_blocks:
self.overflow_blocks.remove(block)
infusion_rate = round(self.total_infused / self.total_unfinished * 100.0, 2)
log.info(
f"Total unfinished blocks: {self.total_unfinished}. "
Expand Down Expand Up @@ -793,9 +797,6 @@ async def _manage_chains(self):
# We've got a new peak, process it.
if self.new_peak is not None:
await self._handle_new_peak()
# A subslot ended, process it.
if self.new_subslot_end is not None:
await self._handle_subslot_end()
# Map free vdf_clients to unspawned chains.
await self._map_chains_with_vdf_clients()
async with self.lock:
Expand Down

0 comments on commit bee0a42

Please sign in to comment.