Skip to content

Commit 1fd12be

Browse files
fix: relay nodes now accept gate messages (skip gate-exists check)
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.
1 parent c35978c commit 1fd12be

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

backend/services/mesh/mesh_hashchain.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,15 @@ def _sanitize_private_gate_event(gate_id: str, event: dict[str, Any]) -> dict[st
286286
return sanitized
287287

288288

289+
def _is_relay_node() -> bool:
290+
"""Return True when this node is running in relay mode."""
291+
try:
292+
from services.config import get_settings
293+
return str(get_settings().MESH_NODE_MODE or "participant").strip().lower() == "relay"
294+
except Exception:
295+
return False
296+
297+
289298
def _authorize_private_gate_transport_author(
290299
gate_id: str,
291300
node_id: str,
@@ -304,6 +313,11 @@ def _authorize_private_gate_transport_author(
304313
reputation_ledger.register_node(candidate, public_key, public_key_algo)
305314
except Exception:
306315
return False, "private gate authorization unavailable"
316+
# Relay nodes are store-and-forward: they don't manage gates locally,
317+
# so they won't have gate configs. Skip the gate-existence check —
318+
# the message is already signature-verified at this point.
319+
if _is_relay_node():
320+
return True, "ok (relay passthrough)"
307321
ok, reason = gate_manager.can_enter(candidate, gate_key)
308322
if ok:
309323
return True, "ok"

0 commit comments

Comments
 (0)