From 4de7490d9712873c6ccf39ba14c5fc0500d5c5bd Mon Sep 17 00:00:00 2001 From: Greg Heartsfield Date: Sat, 19 Nov 2022 10:00:38 -0600 Subject: [PATCH] fix: send EOSE when authors list is empty in subscriptions Fixes: https://todo.sr.ht/~gheartsfield/nostr-rs-relay/49 --- src/db.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/db.rs b/src/db.rs index b3bbb31..a8f2ee2 100644 --- a/src/db.rs +++ b/src/db.rs @@ -471,8 +471,14 @@ fn query_from_filter(f: &ReqFilter) -> (String, Vec>) { } } } - let authors_clause = format!("({})", auth_searches.join(" OR ")); - filter_components.push(authors_clause); + if authvec.len() > 0 { + let authors_clause = format!("({})", auth_searches.join(" OR ")); + filter_components.push(authors_clause); + } else { + // if the authors list was empty, we should never return + // any results. + filter_components.push("false".to_owned()); + } } // Query for Kind if let Some(ks) = &f.kinds {