Discovery protocol: LookupRequest/LookupResponse handlers

Implement the coordinate discovery protocol with flood-based lookup
and reverse-path response routing.

Wire format: LookupRequest (0x30) encode/decode with TTL, visited
bloom filter, origin coords. LookupResponse (0x31) encode/decode
with target coords and Schnorr proof signature.

Handler logic: request dedup by request_id, visited filter loop
prevention, TTL enforcement, lazy purge of expired entries (10s).
Response routing: originator caches route in route_cache, transit
nodes reverse-path forward via recent_requests.

Node state: RecentRequest struct, route_cache (RouteCache), and
recent_requests map for dedup + reverse-path forwarding.

13 handler tests (9 unit + 4 integration) plus 4 protocol tests.
392 tests pass, clean build.
This commit is contained in:
Johnathan Corgan
2026-02-12 14:46:33 +00:00
parent 009101ee4a
commit 9a7fa921ab
8 changed files with 919 additions and 7 deletions
+2 -3
View File
@@ -16,7 +16,6 @@ impl Node {
let msg_type = plaintext[0];
let payload = &plaintext[1..];
// TODO: Implement remaining link message handlers
match msg_type {
0x10 => {
// TreeAnnounce
@@ -28,11 +27,11 @@ impl Node {
}
0x30 => {
// LookupRequest
debug!("Received LookupRequest (not yet implemented)");
self.handle_lookup_request(from, payload).await;
}
0x31 => {
// LookupResponse
debug!("Received LookupResponse (not yet implemented)");
self.handle_lookup_response(from, payload).await;
}
0x40 => {
// SessionDatagram