Skip to content

Commit e53d8de

Browse files
committed
Enforce that a negentropy filter must be a single filter (not a group)
1 parent 6469f49 commit e53d8de

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/apps/relay/RelayIngester.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,13 @@ void RelayServer::ingesterProcessNegentropy(lmdb::txn &txn, uint64_t connId, con
283283
auto maxFilterLimit = cfg().relay__negentropy__maxSyncEvents + 1;
284284

285285
auto filterJson = arr.at(2);
286+
if (!filterJson.is_object()) throw herr("negentropy filter must be an object");
286287

287288
NostrFilterGroup filter = NostrFilterGroup::unwrapped(filterJson, maxFilterLimit);
288289
Subscription sub(connId, subscriptionStr, std::move(filter));
289290

290-
if (filterJson.is_object()) {
291-
filterJson.get_object().erase("since");
292-
filterJson.get_object().erase("until");
293-
}
291+
filterJson.get_object().erase("since");
292+
filterJson.get_object().erase("until");
294293
std::string filterStr = tao::json::to_string(filterJson);
295294

296295
std::string negPayload = from_hex(jsonGetString(arr.at(3), "negentropy payload not a string"));

0 commit comments

Comments
 (0)