From 42b28b94823553b4fc2d21be86900b0707c6a870 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 12 Feb 2024 16:35:26 -0300 Subject: [PATCH] implement NIP-70, protected events. --- src/apps/relay/RelayIngester.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/apps/relay/RelayIngester.cpp b/src/apps/relay/RelayIngester.cpp index d553f5d..77362f5 100644 --- a/src/apps/relay/RelayIngester.cpp +++ b/src/apps/relay/RelayIngester.cpp @@ -92,6 +92,17 @@ void RelayServer::ingesterProcessEvent(lmdb::txn &txn, uint64_t connId, std::str auto *flat = flatbuffers::GetRoot(flatStr.data()); + { + for (const auto &tagArr : origJson.at("tags").get_array()) { + auto tag = tagArr.get_array(); + if (tag.size() == 1 && tag.at(0).get_string() == "-") { + LI << "Protected event, skipping"; + sendOKResponse(connId, to_hex(sv(flat->id())), false, "blocked: event marked as protected"); + return; + } + } + } + { auto existing = lookupEventById(txn, sv(flat->id())); if (existing) {