mirror of
https://github.com/efiten/coredrive-rx.git
synced 2026-12-04 02:04:08 +00:00
A 'rxlog' attribution only happens on a FLOOD route, where path[last] IS the node that transmitted to us — one radio hop away, which is exactly the direct neighbour relation a regions request needs. Those receptions were never candidates. The stated reason was that the packet carries no pubkey to address, but that is not the obstacle: the discover path has the same gap and closes it with a CoreScope lookup, and the app already sends these same prefixes to that endpoint to resolve names. So forwarders now resolve to a full pubkey and become candidates like any other repeater. This fills a real hole rather than adding volume. isOrganicHeard backs the discover sweep off for 15s after any organic reception, so in busy areas — where forwarder traffic is densest — the sweep is suppressed and yields the FEWEST discover-sourced candidates exactly where there is the most to hear. Node type is unknown for a path hash, which is accepted rather than ignored: a node appears in a path only because it RETRANSMITTED the packet, and companions and sensors do not forward, so this population is repeaters and possibly room servers. A non-answerer costs one ask and is then held off by the existing 5/15/30-minute backoff, the same as a repeater that stays silent. No airtime is added either way — both paths share the one-ask-per-60s budget. Whether a 2-byte prefix resolves uniquely often enough to be worth it is a measurement, not a guess, and the app puts the companion in 2-byte path-hash mode itself, so this is the least favourable case. The log header now carries "path keys: N of M path-hash prefixes resolved to a pubkey (K ambiguous or unknown)". It lives in the header because the 200-line ring buffer rolls per-prefix lines out long before a drive ends, and it counts DISTINCT prefixes: resolvePubkey is called on every reception from a forwarder and answers from its session cache, so counting calls would report the busiest node many times over and say nothing about how many forwarders could be identified. Adding a third writer to the candidate map exposed a pre-existing bug worth naming. The map value is the answered-key isTargetDue compares against, and advert-sourced candidates carry a real advertTs while discover- and forwarder-sourced ones carry null. A plain set(pk, null) overwrote a known timestamp, so answered.get(t) !== advertTs for a repeater that HAD answered: it read as due and was asked again for nothing. That already applied to the discover path; a third writer would have tripled it. recordCandidate never downgrades a known timestamp, and returns the EFFECTIVE key so the call site cannot hand a stale null to the ask decision — which was the same bug by a second route. A changed timestamp still overwrites; a re-advert is the documented signal to ask again. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>