diff --git a/modules/validator.py b/modules/validator.py index 950b3451..a462d487 100644 --- a/modules/validator.py +++ b/modules/validator.py @@ -49,30 +49,36 @@ def check_efficiency(self, args): config34 = self.ton.GetConfig34() color_print("{cyan}===[ Validator efficiency ]==={endc}") if validator: - efficiency = 100 if validator.efficiency > 100 else validator.efficiency - color_efficiency = GetColorInt(efficiency, 90, logic="more", ending="%") - created = validator.blocks_created - expected = validator.blocks_expected - start_time = timestamp2utcdatetime(config32.startWorkTime) - end_time = timestamp2utcdatetime(config32.endWorkTime) - color_print(f"Previous round efficiency: {color_efficiency} {{yellow}}({created} blocks created / {expected} blocks expected){{endc}}") - color_print(f"Previous round time: {{yellow}}from {start_time} to {end_time}{{endc}}") + if validator.get('efficiency') is None: + print('Failed to get efficiency for the past round') + else: + efficiency = 100 if validator.efficiency > 100 else validator.efficiency + color_efficiency = GetColorInt(efficiency, 90, logic="more", ending="%") + created = validator.blocks_created + expected = validator.blocks_expected + start_time = timestamp2utcdatetime(config32.startWorkTime) + end_time = timestamp2utcdatetime(config32.endWorkTime) + color_print(f"Previous round efficiency: {color_efficiency} {{yellow}}({created} blocks created / {expected} blocks expected){{endc}}") + color_print(f"Previous round time: {{yellow}}from {start_time} to {end_time}{{endc}}") else: print("Couldn't find this validator in the past round") validator = self.find_myself(validators) if validator: - efficiency = 100 if validator.efficiency > 100 else validator.efficiency - color_efficiency = GetColorInt(efficiency, 90, logic="more", ending="%") - created = validator.blocks_created - expected = validator.blocks_expected - start_time = timestamp2utcdatetime(config34.startWorkTime) - end_time = timestamp2utcdatetime(int(get_timestamp())) - if validator.is_masterchain == False and efficiency < 90: - print("Your validator index is greater than 100.") - print("Efficiency before the validation round is complete may be inaccurate and not displayed.") + if validator.get('efficiency') is None: + print('Failed to get efficiency for the current round') else: - color_print(f"Current round efficiency: {color_efficiency} {{yellow}}({created} blocks created / {expected} blocks expected){{endc}}") - color_print(f"Current round time: {{green}}from {start_time} to {end_time}{{endc}}") + efficiency = 100 if validator.efficiency > 100 else validator.efficiency + color_efficiency = GetColorInt(efficiency, 90, logic="more", ending="%") + created = validator.blocks_created + expected = validator.blocks_expected + start_time = timestamp2utcdatetime(config34.startWorkTime) + end_time = timestamp2utcdatetime(int(get_timestamp())) + if not validator.is_masterchain and efficiency < 90: + print("Your validator index is greater than 100.") + print("Efficiency while the validation round is active may be inaccurate and not displayed.") + else: + color_print(f"Current round efficiency: {color_efficiency} {{yellow}}({created} blocks created / {expected} blocks expected){{endc}}") + color_print(f"Current round time: {{green}}from {start_time} to {end_time}{{endc}}") else: print("Couldn't find this validator in the current round") # end define diff --git a/mytoncore/mytoncore.py b/mytoncore/mytoncore.py index 3b433f8e..5fffd8e8 100644 --- a/mytoncore/mytoncore.py +++ b/mytoncore/mytoncore.py @@ -2650,7 +2650,7 @@ def GetValidatorsList(self, past=False, fast=False): self.SetFunctionBuffer(bname, validators) if past: save_vl = self.GetSaveVl() - save_vl[start] = validators + save_vl[str(start)] = validators return validators #end define