mirror of
https://github.com/lalanza808/monero.fail.git
synced 2025-08-21 04:48:11 -04:00
mark nodes unhealthy if over 100 blocks away from highest (#13)
This commit is contained in:
parent
310905237f
commit
bac563254c
3 changed files with 31 additions and 6 deletions
|
@ -9,6 +9,7 @@ from levin.bucket import Bucket
|
|||
from levin.ctypes import *
|
||||
from levin.constants import LEVIN_SIGNATURE
|
||||
|
||||
from xmrnodes.models import Node
|
||||
from xmrnodes import config
|
||||
|
||||
|
||||
|
@ -119,3 +120,11 @@ def retrieve_peers(host, port):
|
|||
return peers
|
||||
else:
|
||||
return None
|
||||
|
||||
def get_highest_block(nettype, crypto):
|
||||
highest = Node.select().where(
|
||||
Node.validated == True,
|
||||
Node.nettype == nettype,
|
||||
Node.crypto == crypto
|
||||
).order_by(Node.last_height.desc()).limit(1).first()
|
||||
return highest.last_height
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue