Skip to content

Commit

Permalink
Timlord updates state immediately, prevents race condition (#1271)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariano54 authored Mar 13, 2021
1 parent 0be31f7 commit de61385
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/consensus/difficulty_adjustment.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def _get_next_difficulty(
"""
next_height: uint32 = uint32(height + 1)

if next_height < constants.EPOCH_BLOCKS:
if next_height < (constants.EPOCH_BLOCKS - 3 * constants.MAX_SUB_SLOT_BLOCKS):
# We are in the first epoch
return uint64(constants.DIFFICULTY_STARTING)

Expand Down
2 changes: 2 additions & 0 deletions src/timelord/timelord.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,8 @@ async def _check_for_end_of_subslot(self):
self.overflow_blocks = []
self.new_subslot_end = eos_bundle

await self._handle_subslot_end()

async def _handle_failures(self):
while len(self.vdf_failures) > 0:
log.error(f"Vdf clients failed {self.vdf_failures_count} times.")
Expand Down

0 comments on commit de61385

Please sign in to comment.