@@ -76,9 +76,9 @@ def init_alerts():
76
76
),
77
77
"zero_block_created" : Alert (
78
78
"critical" ,
79
- f"Validator has not created any blocks in the { int (VALIDATION_PERIOD // 3 // 3600 )} hours" ,
80
- "Validator has not created any blocks in the last {hours} hours." ,
81
- VALIDATION_PERIOD // 3
79
+ f"Validator has not created any blocks in the { int (VALIDATION_PERIOD // 6 // 3600 )} hours" ,
80
+ "Validator has not created any blocks in the last <b> {hours} hours</b> ." ,
81
+ VALIDATION_PERIOD // 6
82
82
),
83
83
"validator_slashed" : Alert (
84
84
"high" ,
@@ -95,13 +95,13 @@ def init_alerts():
95
95
"stake_accepted" : Alert (
96
96
"info" ,
97
97
"Validator's stake has been accepted (info alert with no sound)" ,
98
- "Validator's stake {stake} TON has been accepted" ,
98
+ "Validator's stake <b> {stake} TON</b> has been accepted" ,
99
99
ELECTIONS_START_BEFORE
100
100
),
101
101
"stake_returned" : Alert (
102
102
"info" ,
103
103
"Validator's stake has been returned (info alert with no sound)" ,
104
- "Validator's stake {stake} TON has been returned on address <code>{address}</code>. The reward amount is {reward} TON." ,
104
+ "Validator's stake <b> {stake} TON</b> has been returned on address <code>{address}</code>. The reward amount is <b> {reward} TON</b> ." ,
105
105
60
106
106
),
107
107
"stake_not_returned" : Alert (
@@ -158,6 +158,11 @@ def send_alert(self, alert_name: str, *args, **kwargs):
158
158
if alert is None :
159
159
raise Exception (f"Alert { alert_name } not found" )
160
160
alert_name_readable = alert_name .replace ('_' , ' ' ).title ()
161
+
162
+ for key , value in kwargs .items ():
163
+ if isinstance (value , (int , float )):
164
+ kwargs [key ] = f'{ value :,} ' .replace (',' , ' ' ) # make space separator for thousands
165
+
161
166
text = '🆘' if alert .severity != 'info' else ''
162
167
text += f''' <b>Node { self .hostname } : { alert_name_readable } </b>
163
168
@@ -341,7 +346,7 @@ def check_zero_blocks_created(self):
341
346
if not self .ton .using_validator ():
342
347
return
343
348
ts = get_timestamp ()
344
- period = VALIDATION_PERIOD // 3 # 6h for mainnet, 40m for testnet
349
+ period = VALIDATION_PERIOD // 6 # 3h for mainnet, 40m for testnet
345
350
start , end = ts - period , ts - 60
346
351
config34 = self .ton .GetConfig34 ()
347
352
if start < config34 .startWorkTime : # round started recently
@@ -394,7 +399,7 @@ def check_stake_sent(self):
394
399
if res is False :
395
400
self .send_alert ("stake_not_accepted" )
396
401
return
397
- self .send_alert ("stake_accepted" , stake = round (res .get ('stake' ), 2 ))
402
+ self .send_alert ("stake_accepted" , stake = round (res .get ('stake' )))
398
403
399
404
def check_stake_returned (self ):
400
405
if not self .ton .using_validator ():
@@ -409,7 +414,7 @@ def check_stake_returned(self):
409
414
410
415
for tr in trs :
411
416
if tr .time >= config ['endWorkTime' ] + FREEZE_PERIOD and tr .srcAddr == '3333333333333333333333333333333333333333333333333333333333333333' and tr .body .startswith ('F96F7324' ): # Elector Recover Stake Response
412
- self .send_alert ("stake_returned" , stake = round (tr .value , 2 ), address = res ["walletAddr" ], reward = round (tr .value - res .get ('stake' , 0 ), 2 ))
417
+ self .send_alert ("stake_returned" , stake = round (tr .value ), address = res ["walletAddr" ], reward = round (tr .value - res .get ('stake' , 0 ), 2 ))
413
418
return
414
419
self .send_alert ("stake_not_returned" , address = res ["walletAddr" ])
415
420
0 commit comments