From a0b85129d4af71e52e56af3eeb2c2f01cf67414d Mon Sep 17 00:00:00 2001 From: William Casarin Date: Fri, 21 Mar 2025 14:53:59 -0700 Subject: [PATCH] nostrdb: relay: fix race condition bug Signed-off-by: William Casarin --- nostrdb/src/nostrdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nostrdb/src/nostrdb.c b/nostrdb/src/nostrdb.c index 2ac9ee75..f6eaf92a 100644 --- a/nostrdb/src/nostrdb.c +++ b/nostrdb/src/nostrdb.c @@ -4679,7 +4679,7 @@ static uint64_t ndb_write_note(struct ndb_txn *txn, relay_len = strlen(note->relay); // let's quickly sanity check if we already have this note - if (ndb_get_notekey_by_id(txn, note->note->id)) { + if ((note_key = ndb_get_notekey_by_id(txn, note->note->id))) { // even if we do we still need to write relay index ndb_write_note_relay_kind_index(txn, kind, note_key, ndb_note_created_at(note->note),