From e2869e8fad69c6c4c1f92a57d212018a8214a6a2 Mon Sep 17 00:00:00 2001 From: Greg Heartsfield Date: Tue, 24 Jan 2023 08:04:42 -0600 Subject: [PATCH] fix(NIP-16): do not replace events unless they are newer --- src/repo/sqlite.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repo/sqlite.rs b/src/repo/sqlite.rs index f69225a..8ac92a9 100644 --- a/src/repo/sqlite.rs +++ b/src/repo/sqlite.rs @@ -109,7 +109,7 @@ impl SqliteRepo { // check for replaceable events that would hide this one; we won't even attempt to insert these. if e.is_replaceable() { let repl_count = tx.query_row( - "SELECT e.id FROM event e INDEXED BY author_index WHERE e.author=? AND e.kind=? AND e.created_at > ? LIMIT 1;", + "SELECT e.id FROM event e INDEXED BY author_index WHERE e.author=? AND e.kind=? AND e.created_at >= ? LIMIT 1;", params![pubkey_blob, e.kind, e.created_at], |row| row.get::(0)); if repl_count.ok().is_some() { return Ok(0);