@@ -504,13 +504,11 @@ def Complaints(local, ton):
504504 # Voting for complaints
505505 config32 = ton .GetConfig32 ()
506506 electionId = config32 .get ("startWorkTime" )
507- complaintsHashes = ton .SaveComplaints (electionId )
508- complaints = ton .GetComplaints (electionId )
509- for key , item in complaints .items ():
510- complaintHash = item .get ("hash" )
511- complaintHash_hex = Dec2HexAddr (complaintHash )
512- if complaintHash_hex in complaintsHashes :
513- ton .VoteComplaint (electionId , complaintHash )
507+ complaints = ton .GetComplaints (electionId ) # get complaints from Elector
508+ for c in complaints .values ():
509+ complaint_hash = c .get ("hash" )
510+ if ton .complaint_is_valid (c ):
511+ ton .VoteComplaint (electionId , complaint_hash )
514512# end define
515513
516514
@@ -525,6 +523,10 @@ def Slashing(local, ton):
525523 config32 = ton .GetConfig32 ()
526524 start = config32 .get ("startWorkTime" )
527525 end = config32 .get ("endWorkTime" )
526+ config15 = ton .GetConfig15 ()
527+ ts = get_timestamp ()
528+ if not (end < ts < end + config15 ['stakeHeldFor' ]): # check that currently is freeze time
529+ return
528530 local .add_log ("slash_time {}, start {}, end {}" .format (slash_time , start , end ), "debug" )
529531 if slash_time != start :
530532 end -= 60
@@ -560,15 +562,20 @@ def ScanLiteServers(local, ton):
560562def General (local ):
561563 local .add_log ("start General function" , "debug" )
562564 ton = MyTonCore (local )
563- scanner = Dict ()
565+ # scanner = Dict()
564566 # scanner.Run()
565567
566- # Запустить потоки
568+ # Start threads
567569 local .start_cycle (Elections , sec = 600 , args = (local , ton , ))
568570 local .start_cycle (Statistics , sec = 10 , args = (local , ))
569571 local .start_cycle (Offers , sec = 600 , args = (local , ton , ))
570- local .start_cycle (Complaints , sec = 600 , args = (local , ton , ))
571- local .start_cycle (Slashing , sec = 600 , args = (local , ton , ))
572+
573+ t = 600
574+ if ton .GetNetworkName () != 'mainnet' :
575+ t = 60
576+ local .start_cycle (Complaints , sec = t , args = (local , ton , ))
577+ local .start_cycle (Slashing , sec = t , args = (local , ton , ))
578+
572579 local .start_cycle (Domains , sec = 600 , args = (local , ton , ))
573580 local .start_cycle (Telemetry , sec = 60 , args = (local , ton , ))
574581 local .start_cycle (OverlayTelemetry , sec = 7200 , args = (local , ton , ))
0 commit comments