mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-11-22 08:17:28 +00:00
A directed REQUEST_SYNC is for its recipient only. When the requester has no link to the recipient, the send falls back to every link. Other neighbours then get the request. The responder did not check the recipient. So they answered a request that was not for them, and a reply can be many packets. The ingress guard now rejects a REQUEST_SYNC whose recipient is set and is not this node. This covers link frames and reassembled packets. Broadcast requests are unchanged. The check runs before the ingress record and the duplicate filter on purpose. One periodic round sends a directed request to each connected peer. Two copies with the same millisecond timestamp share a packet ID, because the ID has no recipient. If a stray copy arrives first and is dropped later, the addressee drops its own copy as a duplicate. The requester now builds the recipient from PeerID.routingData instead of parsing hex by hand. A long-form peer ID then still gives the 8-byte ID that responders compare against. BLEIngressPacketGuardTests checks the rule. The end-to-end test requestSyncIsAnsweredOnlyByItsRecipient sends a stray copy and then our own copy with the same packet ID through the real ingress path. The first gets no reply, and the second does. Full SwiftPM suite green: 2202 tests in 237 suites.