From 1fd12beb7ae48fdadaf24a3aaf5059599a091ab5 Mon Sep 17 00:00:00 2001 From: anoracleofra-code Date: Fri, 27 Mar 2026 21:56:46 -0600 Subject: [PATCH] fix: relay nodes now accept gate messages (skip gate-exists check) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Relay nodes run in store-and-forward mode with no local gate configs, so gate_manager.can_enter() always returned "Gate does not exist" — silently rejecting every pushed gate message. This broke cross-node gate message delivery entirely since no relay ever stored anything. Relay mode now skips the gate-existence check after signature verification passes, allowing encrypted gate blobs to flow through. --- backend/services/mesh/mesh_hashchain.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/backend/services/mesh/mesh_hashchain.py b/backend/services/mesh/mesh_hashchain.py index 3cdf463..23ec875 100644 --- a/backend/services/mesh/mesh_hashchain.py +++ b/backend/services/mesh/mesh_hashchain.py @@ -286,6 +286,15 @@ def _sanitize_private_gate_event(gate_id: str, event: dict[str, Any]) -> dict[st return sanitized +def _is_relay_node() -> bool: + """Return True when this node is running in relay mode.""" + try: + from services.config import get_settings + return str(get_settings().MESH_NODE_MODE or "participant").strip().lower() == "relay" + except Exception: + return False + + def _authorize_private_gate_transport_author( gate_id: str, node_id: str, @@ -304,6 +313,11 @@ def _authorize_private_gate_transport_author( reputation_ledger.register_node(candidate, public_key, public_key_algo) except Exception: return False, "private gate authorization unavailable" + # Relay nodes are store-and-forward: they don't manage gates locally, + # so they won't have gate configs. Skip the gate-existence check — + # the message is already signature-verified at this point. + if _is_relay_node(): + return True, "ok (relay passthrough)" ok, reason = gate_manager.can_enter(candidate, gate_key) if ok: return True, "ok"