Fix node_health to determine based on RPC responsiveness instead of non-existent health endpoint

This commit is contained in:
aitbc
2026-05-19 19:14:43 +02:00
parent d24e1100de
commit b1e2c750d3

View File

@@ -191,9 +191,10 @@ def get_live_chain_data() -> Dict[str, Any]:
def get_live_discovery() -> Dict[str, Any]:
"""Get live discovery data"""
head = rpc_query("head")
health = rpc_query("health") or {}
block_height = head.get("height", 0) if head else 0
# Determine health based on RPC responsiveness
node_health = "healthy" if head else "unhealthy"
return {
"network": {
@@ -202,7 +203,7 @@ def get_live_discovery() -> Dict[str, Any]:
"description": "AI-powered blockchain platform",
"live_status": {
"current_height": block_height,
"node_health": health.get("status", "unknown"),
"node_health": node_health,
"last_update": datetime.now(timezone.utc).isoformat()
},
"apis": {