Add relay health check and tests

This commit is contained in:
thePR0M3TH3AN
2025-07-03 09:44:09 -04:00
parent 408d005e28
commit 3364824fc4
4 changed files with 66 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ from utils.password_prompt import (
prompt_existing_password,
confirm_action,
)
from constants import MIN_HEALTHY_RELAYS
from constants import (
APP_DIR,
@@ -763,6 +764,17 @@ class PasswordManager:
parent_seed=getattr(self, "parent_seed", None),
)
if hasattr(self.nostr_client, "check_relay_health"):
healthy = self.nostr_client.check_relay_health(MIN_HEALTHY_RELAYS)
if healthy < MIN_HEALTHY_RELAYS:
print(
colored(
f"Only {healthy} relay(s) responded with your latest event."
" Consider adding more relays via Settings.",
"yellow",
)
)
logger.debug("Managers re-initialized for the new fingerprint.")
except Exception as e: