def monitoring_block_count():
# set bot
bot = Bot(api_key)
count = int(rpc({"action": "block_count"}, 'count'))
reference_count = int(reference_block_count())
http = urllib3.PoolManager(cert_reqs='CERT_REQUIRED',ca_certs=certifi.where())
response = http.request('GET', summary_url, headers=header, timeout=20.0)
try:
json_data = json.loads(response.data)
community_count = int(json_data['blocks'])
except ValueError as e:
community_count = reference_count
difference = int(math.fabs(community_count - count))
response = http.request('GET', block_count_url, headers=header, timeout=20.0)
raiwallet_count = int(response.data)
if (difference > block_count_difference_threshold):
# Warning to admins
for user_id in admin_list:
push(bot, user_id, 'Block count: {0}\nCommunity: {1}\nDifference: *{2}*\nReference: {3}\nraiwallet.info: {4}'.format(count, community_count, difference, reference_count, raiwallet_count))
# trying to fix
bootstrap_multi()
评论列表
文章目录