nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

commit 6eab55daef7487d546bcab2702dd4faad0f6de00
parent f76ba7ad5af6ccfd3b3f87cd9a2e6a726b193b1f
Author: William Casarin <jb55@jb55.com>
Date:   Wed,  3 Jan 2024 14:44:54 -0800

subs: always fail when calling wait_for_notes on a subid of 0

this is an invalid subscription id

Diffstat:
Msrc/nostrdb.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/nostrdb.c b/src/nostrdb.c @@ -4955,6 +4955,11 @@ int ndb_wait_for_notes(struct ndb *ndb, uint64_t subid, uint64_t *note_ids, int note_id_capacity) { struct ndb_subscription *sub; + + // this is not a valid subscription id + if (subid == 0) + return 0; + if (!(sub = ndb_find_subscription(ndb, subid))) return 0;