Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions miners/fingerprint_checks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
"""
Platform-aware fingerprint checks wrapper.

Automatically detects the current platform and delegates to the
platform-specific fingerprint_checks module (miners/<platform>/).

Usage:
python3 miners/fingerprint_checks.py
"""

import importlib.util
import os
import platform
import sys

_script_dir = os.path.dirname(os.path.abspath(__file__))
_platform = platform.system().lower()

_subdir = {"linux": "linux", "windows": "windows", "darwin": "macos"}.get(_platform, "linux")
_fp_path = os.path.join(_script_dir, _subdir, "fingerprint_checks.py")

if not os.path.exists(_fp_path):
print(f"Error: no fingerprint_checks.py found for platform '{_platform}'", file=sys.stderr)
print(f"Expected at: {_fp_path}", file=sys.stderr)
sys.exit(1)

_spec = importlib.util.spec_from_file_location(f"fingerprint_checks_{_subdir}", _fp_path)
_mod = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_mod)

# Re-export all public symbols for backward compatibility
for _attr in dir(_mod):
if not _attr.startswith("_"):
globals()[_attr] = getattr(_mod, _attr)

if __name__ == "__main__":
# If the module has a main-like entry point, run it
if hasattr(_mod, "main"):
_mod.main()
else:
print(f"fingerprint_checks ({_platform}) loaded successfully.")
print(f"Available functions: {[a for a in dir(_mod) if not a.startswith('_')]}")
7 changes: 6 additions & 1 deletion node/rustchain_v2_integrated_v2.2.1_rip200.py
Original file line number Diff line number Diff line change
Expand Up @@ -9005,7 +9005,12 @@ def _tip_age_slots():
try:
with sqlite3.connect(DB_PATH, timeout=3) as db:
row = db.execute("SELECT slot FROM headers ORDER BY slot DESC LIMIT 1").fetchone()
return 0 if row else None
if row is None:
return None
latest_slot = row[0]
now_slot = current_slot()
age = now_slot - latest_slot
return max(0, age)
except Exception:
return None

Expand Down
6 changes: 4 additions & 2 deletions tools/rustchain-health.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ def render(snapshot: Dict[str, Any]) -> str:
# ── Overall ───
all_ok = (h.get("ok", False) and h["reachable"]
and e["reachable"]
and m["reachable"])
and m["reachable"]
and t["reachable"])
lines.append(dim(" " + "─" * w))
if all_ok:
lines.append(f" {green(bold('STATUS: ALL SYSTEMS OPERATIONAL'))}")
Expand Down Expand Up @@ -358,7 +359,8 @@ def run_once() -> int:
all_ok = (snapshot["health"].get("ok", False)
and snapshot["health"]["reachable"]
and snapshot["epoch"]["reachable"]
and snapshot["miners"]["reachable"])
and snapshot["miners"]["reachable"]
and snapshot["tip"]["reachable"])
return 0 if all_ok else 1

if args.watch > 0:
Expand Down
Loading