diff --git a/modules/alert_bot.py b/modules/alert_bot.py
index f39383c3..1c88af8d 100644
--- a/modules/alert_bot.py
+++ b/modules/alert_bot.py
@@ -76,9 +76,9 @@ def init_alerts():
),
"zero_block_created": Alert(
"critical",
- f"Validator has not created any blocks in the {int(VALIDATION_PERIOD // 3 // 3600)} hours",
- "Validator has not created any blocks in the last {hours} hours.",
- VALIDATION_PERIOD // 3
+ f"Validator has not created any blocks in the {int(VALIDATION_PERIOD // 6 // 3600)} hours",
+ "Validator has not created any blocks in the last {hours} hours.",
+ VALIDATION_PERIOD // 6
),
"validator_slashed": Alert(
"high",
@@ -95,13 +95,13 @@ def init_alerts():
"stake_accepted": Alert(
"info",
"Validator's stake has been accepted (info alert with no sound)",
- "Validator's stake {stake} TON has been accepted",
+ "Validator's stake {stake} TON has been accepted",
ELECTIONS_START_BEFORE
),
"stake_returned": Alert(
"info",
"Validator's stake has been returned (info alert with no sound)",
- "Validator's stake {stake} TON has been returned on address {address}
. The reward amount is {reward} TON.",
+ "Validator's stake {stake} TON has been returned on address {address}
. The reward amount is {reward} TON.",
60
),
"stake_not_returned": Alert(
@@ -158,6 +158,11 @@ def send_alert(self, alert_name: str, *args, **kwargs):
if alert is None:
raise Exception(f"Alert {alert_name} not found")
alert_name_readable = alert_name.replace('_', ' ').title()
+
+ for key, value in kwargs.items():
+ if isinstance(value, (int, float)):
+ kwargs[key] = f'{value:,}'.replace(',', ' ') # make space separator for thousands
+
text = '🆘' if alert.severity != 'info' else ''
text += f''' Node {self.hostname}: {alert_name_readable}
@@ -341,7 +346,7 @@ def check_zero_blocks_created(self):
if not self.ton.using_validator():
return
ts = get_timestamp()
- period = VALIDATION_PERIOD // 3 # 6h for mainnet, 40m for testnet
+ period = VALIDATION_PERIOD // 6 # 3h for mainnet, 40m for testnet
start, end = ts - period, ts - 60
config34 = self.ton.GetConfig34()
if start < config34.startWorkTime: # round started recently
@@ -394,7 +399,7 @@ def check_stake_sent(self):
if res is False:
self.send_alert("stake_not_accepted")
return
- self.send_alert("stake_accepted", stake=round(res.get('stake'), 2))
+ self.send_alert("stake_accepted", stake=round(res.get('stake')))
def check_stake_returned(self):
if not self.ton.using_validator():
@@ -409,7 +414,7 @@ def check_stake_returned(self):
for tr in trs:
if tr.time >= config['endWorkTime'] + FREEZE_PERIOD and tr.srcAddr == '3333333333333333333333333333333333333333333333333333333333333333' and tr.body.startswith('F96F7324'): # Elector Recover Stake Response
- self.send_alert("stake_returned", stake=round(tr.value, 2), address=res["walletAddr"], reward=round(tr.value - res.get('stake', 0), 2))
+ self.send_alert("stake_returned", stake=round(tr.value), address=res["walletAddr"], reward=round(tr.value - res.get('stake', 0), 2))
return
self.send_alert("stake_not_returned", address=res["walletAddr"])