@@ -1376,6 +1376,7 @@ def ElectionEntry(self, args=None):
13761376 addrB64 = wallet .addrB64
13771377 if wallet is None :
13781378 raise Exception ("Validator wallet not found" )
1379+ #end if
13791380
13801381 self .local .add_log ("start ElectionEntry function" , "debug" )
13811382 # Check if validator is not synchronized
@@ -1384,6 +1385,7 @@ def ElectionEntry(self, args=None):
13841385 if validatorOutOfSync > 60 :
13851386 self .local .add_log ("Validator is not synchronized" , "error" )
13861387 return
1388+ #end if
13871389
13881390 # Get startWorkTime and endWorkTime
13891391 fullElectorAddr = self .GetFullElectorAddr ()
@@ -1405,6 +1407,7 @@ def ElectionEntry(self, args=None):
14051407 if (startWorkTime - now ) > self .local .db ["participateBeforeEnd" ] and \
14061408 (now + self .local .db ["periods" ]["elections" ]) < startWorkTime :
14071409 return
1410+ #end if
14081411
14091412 vconfig = self .GetValidatorConfig ()
14101413
@@ -1414,14 +1417,17 @@ def ElectionEntry(self, args=None):
14141417 if base64 .b64decode (a .id ) == adnl_addr_bytes :
14151418 have_adnl = True
14161419 break
1420+ #end for
14171421 if not have_adnl :
14181422 raise Exception ('ADNL address is not found' )
1423+ #end if
14191424
14201425 # Check if election entry already completed
14211426 entries = self .GetElectionEntries ()
14221427 if adnl_addr in entries :
14231428 self .local .add_log ("Elections entry already completed" , "info" )
14241429 return
1430+ #end if
14251431
14261432 if usePool :
14271433 pool = self .get_pool ()
@@ -3542,17 +3548,20 @@ def GetPools(self):
35423548 pool = self .GetLocalPool (poolName )
35433549 pools .append (pool )
35443550 return pools
3551+ #end define
35453552
35463553 def get_pool (self ):
35473554 pools = self .GetPools ()
35483555 for pool in pools :
35493556 if self .is_pool_ready_to_stake (pool ):
35503557 return pool
35513558 raise Exception ("Validator pool not found or not ready" )
3559+ #end define
35523560
35533561 def get_pool_last_sent_stake_time (self , addrB64 ):
35543562 pool_data = self .GetPoolData (addrB64 )
35553563 return pool_data ["stakeAt" ]
3564+ #end define
35563565
35573566 def is_pool_ready_to_stake (self , pool : Pool ):
35583567 addr = pool .addrB64
@@ -3574,10 +3583,12 @@ def is_pool_ready_to_stake(self, pool: Pool):
35743583 result = last_sent_stake_time + stake_freeze_delay < now
35753584 print (f"{ addr } : { result } . { last_sent_stake_time } , { stake_freeze_delay } , { now } " )
35763585 return result
3586+ #end define
35773587
35783588 def is_account_single_nominator (self , account : Account ):
35793589 account_version = self .GetVersionFromCodeHash (account .codeHash )
35803590 return account_version is not None and 'spool' in account_version
3591+ #end define
35813592
35823593 def GetPoolData (self , addrB64 ):
35833594 self .local .add_log ("start GetPoolData function" , "debug" )
0 commit comments