@@ -42,33 +42,39 @@ def find_myself(self, validators: list) -> dict:
4242
4343 def check_efficiency (self , args ):
4444 self .local .add_log ("start GetValidatorEfficiency function" , "debug" )
45- validators = self .ton .GetValidatorsList (past = True )
46- validator = self .find_myself (validators )
45+ previous_validators = self .ton .GetValidatorsList (past = True )
46+ validators = self .ton .GetValidatorsList ()
47+ validator = self .find_myself (previous_validators )
4748 config32 = self .ton .GetConfig32 ()
49+ config34 = self .ton .GetConfig34 ()
50+ color_print ("{cyan}===[ Validator efficiency ]==={endc}" )
4851 if validator :
49- efficiency = GetColorInt (validator ["efficiency" ], 90 , logic = "more" , ending = " %" )
50- expected = validator ['blocks_expected' ]
51- created = validator ['blocks_created' ]
52- print ('#' * 30 )
53- print (
54- f"Previous round efficiency: { efficiency } ({ created } blocks created / { expected } blocks expected) from { timestamp2utcdatetime (config32 ['startWorkTime' ])} to { timestamp2utcdatetime (config32 ['endWorkTime' ])} " )
55- print ('#' * 30 )
52+ efficiency = 100 if validator .efficiency > 100 else validator .efficiency
53+ color_efficiency = GetColorInt (efficiency , 90 , logic = "more" , ending = "%" )
54+ created = validator .blocks_created
55+ expected = validator .blocks_expected
56+ start_time = timestamp2utcdatetime (config32 .startWorkTime )
57+ end_time = timestamp2utcdatetime (config32 .endWorkTime )
58+ color_print (f"Previous round efficiency: { color_efficiency } {{yellow}}({ created } blocks created / { expected } blocks expected){{endc}}" )
59+ color_print (f"Previous round time: {{yellow}}from { start_time } to { end_time } {{endc}}" )
5660 else :
5761 print ("Couldn't find this validator in the past round" )
58- validators = self .ton .GetValidatorsList ()
5962 validator = self .find_myself (validators )
60- config34 = self .ton .GetConfig34 ()
6163 if validator :
62- efficiency = GetColorInt (validator ["efficiency" ], 90 , logic = "more" , ending = " %" )
63- expected = validator ['blocks_expected' ]
64- created = validator ['blocks_created' ]
65- print ('#' * 30 )
66- print (
67- f"Current round efficiency: { efficiency } ({ created } blocks created / { expected } blocks expected) from { timestamp2utcdatetime (config34 ['startWorkTime' ])} to { timestamp2utcdatetime (int (get_timestamp ()))} " )
68- print ('#' * 30 )
64+ efficiency = 100 if validator .efficiency > 100 else validator .efficiency
65+ color_efficiency = GetColorInt (efficiency , 90 , logic = "more" , ending = "%" )
66+ created = validator .blocks_created
67+ expected = validator .blocks_expected
68+ start_time = timestamp2utcdatetime (config34 .startWorkTime )
69+ end_time = timestamp2utcdatetime (int (get_timestamp ()))
70+ if validator .is_masterchain == False and efficiency < 90 :
71+ print ("Your validator index is greater than 100." )
72+ print ("Efficiency before the validation round is complete may be inaccurate and not displayed." )
73+ else :
74+ color_print (f"Current round efficiency: { color_efficiency } {{yellow}}({ created } blocks created / { expected } blocks expected){{endc}}" )
75+ color_print (f"Current round time: {{green}}from { start_time } to { end_time } {{endc}}" )
6976 else :
7077 print ("Couldn't find this validator in the current round" )
71-
7278 # end define
7379
7480 def add_console_commands (self , console ):
0 commit comments