From de6138583b33d97f6ca0c2206657295201e36d1d Mon Sep 17 00:00:00 2001 From: Mariano Sorgente <3069354+mariano54@users.noreply.github.com> Date: Sun, 14 Mar 2021 03:03:05 +0900 Subject: [PATCH] Timlord updates state immediately, prevents race condition (#1271) --- src/consensus/difficulty_adjustment.py | 2 +- src/timelord/timelord.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/consensus/difficulty_adjustment.py b/src/consensus/difficulty_adjustment.py index 4f9b53cedddc..57e0dbc1d585 100644 --- a/src/consensus/difficulty_adjustment.py +++ b/src/consensus/difficulty_adjustment.py @@ -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) diff --git a/src/timelord/timelord.py b/src/timelord/timelord.py index e228017bef9f..195cb0e28b83 100644 --- a/src/timelord/timelord.py +++ b/src/timelord/timelord.py @@ -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.")