From fa40ede9e72bcd7ddb69bd1195202e13ac4b7e89 Mon Sep 17 00:00:00 2001 From: you Date: Fri, 20 Mar 2026 08:31:07 +0000 Subject: [PATCH] fix: findPacketsForNode always resolves name, even when called with pubkey --- packet-store.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packet-store.js b/packet-store.js index 0630bab..4757f8f 100644 --- a/packet-store.js +++ b/packet-store.js @@ -98,13 +98,11 @@ class PacketStore { let pubkey = nodeIdOrName; let nodeName = nodeIdOrName; - // Resolve: if not a known pubkey, look up in nodes table - if (!this.byNode.has(nodeIdOrName)) { - try { - const row = this.db.prepare("SELECT public_key, name FROM nodes WHERE public_key = ? OR name = ? LIMIT 1").get(nodeIdOrName, nodeIdOrName); - if (row) { pubkey = row.public_key; nodeName = row.name || nodeIdOrName; } - } catch {} - } + // Always resolve to get both pubkey and name + try { + const row = this.db.prepare("SELECT public_key, name FROM nodes WHERE public_key = ? OR name = ? LIMIT 1").get(nodeIdOrName, nodeIdOrName); + if (row) { pubkey = row.public_key; nodeName = row.name || nodeIdOrName; } + } catch {} // Combine: index hits + text search by both name and pubkey const indexed = this.byNode.get(pubkey);