From ee58e648a604c4046e9dfa2844d34fc1bb79efcd Mon Sep 17 00:00:00 2001 From: you Date: Sat, 21 Mar 2026 18:43:48 +0000 Subject: [PATCH] Fix hash_size using first-seen-wins instead of last-seen-wins The hashSizeMap was guarded by !hashSizeMap.has(pk), meaning the oldest ADVERT determined a node's hash_size permanently. If a node upgraded firmware from 1-byte to 2-byte hash prefix, the stale value persisted. Remove the guard so newer packets overwrite older ones (last-seen-wins). --- server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 3bb5e616..01ec834d 100644 --- a/server.js +++ b/server.js @@ -1087,7 +1087,7 @@ app.get('/api/nodes', (req, res) => { try { const d = JSON.parse(p.decoded_json || '{}'); const pk = d.pubKey || d.public_key; - if (pk && !hashSizeMap.has(pk)) { + if (pk) { const pathByte = parseInt(p.raw_hex.slice(2, 4), 16); hashSizeMap.set(pk, ((pathByte >> 6) & 0x3) + 1); } @@ -1111,7 +1111,7 @@ app.get('/api/nodes', (req, res) => { if (p.decoded_json) { const d = JSON.parse(p.decoded_json); const pk = d.pubKey || d.public_key; - if (pk && !hashSizeMap.has(pk)) hashSizeMap.set(pk, hs); + if (pk) hashSizeMap.set(pk, hs); } } }