bugfix: NIP-20 says duplicate messages should return written = true

This commit is contained in:
Doug Hoyte
2023-01-13 11:46:38 -05:00
parent 908b088642
commit 3009ac1305
2 changed files with 2 additions and 1 deletions

View File

@ -85,7 +85,7 @@ void RelayServer::ingesterProcessEvent(lmdb::txn &txn, uint64_t connId, secp256k
auto existing = lookupEventById(txn, sv(flat->id())); auto existing = lookupEventById(txn, sv(flat->id()));
if (existing) { if (existing) {
LI << "Duplicate event, skipping"; LI << "Duplicate event, skipping";
sendOKResponse(connId, to_hex(sv(flat->id())), false, "duplicate: have this event"); sendOKResponse(connId, to_hex(sv(flat->id())), true, "duplicate: have this event");
return; return;
} }
} }

View File

@ -41,6 +41,7 @@ void RelayServer::runWriter(ThreadPool<MsgWriter>::Thread &thr) {
written = true; written = true;
} else if (newEvent.status == EventWriteStatus::Duplicate) { } else if (newEvent.status == EventWriteStatus::Duplicate) {
message = "duplicate: have this event"; message = "duplicate: have this event";
written = true;
} else if (newEvent.status == EventWriteStatus::Replaced) { } else if (newEvent.status == EventWriteStatus::Replaced) {
message = "replaced: have newer event"; message = "replaced: have newer event";
} else if (newEvent.status == EventWriteStatus::Deleted) { } else if (newEvent.status == EventWriteStatus::Deleted) {