mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 05:25:20 +00:00
Fix geohash filtering (#376)
* fix(geohash): enforce client-side filter on subscription and validate 'g' tag in handler; move dedup after validation; avoid misrouting events across geohashes * cleanup duplicate code block * remove
This commit is contained in:
@@ -666,6 +666,16 @@ class NostrRelayManager private constructor() {
|
||||
relay?.messagesReceived = (relay?.messagesReceived ?: 0) + 1
|
||||
updateRelaysList()
|
||||
|
||||
// CLIENT-SIDE FILTER ENFORCEMENT: Ensure this event matches the subscription's filter
|
||||
activeSubscriptions[response.subscriptionId]?.let { subInfo ->
|
||||
val matches = try { subInfo.filter.matches(response.event) } catch (e: Exception) { true }
|
||||
if (!matches) {
|
||||
Log.v(TAG, "🚫 Dropping event ${response.event.id.take(16)}... not matching filter for sub=${response.subscriptionId}")
|
||||
// Do NOT call deduplicator here to allow the correct subscription to process it later
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// DEDUPLICATION: Check if we've already processed this event
|
||||
val wasProcessed = eventDeduplicator.processEvent(response.event) { event ->
|
||||
// Only log non-gift-wrap events to reduce noise
|
||||
|
||||
Reference in New Issue
Block a user