mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-05-14 20:25:06 +00:00
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).
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user