mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-08-22 07:06:05 +00:00
Per Codex review on PR #743: the previous ordering called dedupe(event.id) before isValidSignature(), so a forged event (bad signature, but a content-derived id matching a legitimate event) would get its id marked as "seen" and dropped — permanently poisoning the dedup cache. When the genuine, validly-signed copy of the same event later arrived (e.g. via a different relay), it was then silently discarded too, as an apparent duplicate. Move the signature check ahead of dedupe() so only genuinely-authenticated event ids are ever cached, matching the ordering already used correctly in NostrClient.handleGeohashMessage() and LocationNotesManager.handleEvent(). Adds a regression test that reproduces the exact scenario: a forged event is rejected first, then a genuine event with the same id must still be rendered (previously failed against the pre-fix ordering). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>