mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2025-03-14 17:37:12 -04:00
fix: only send events to the nip05 verifier if grpc permits
Prior to this, the NIP05 verifier would receieve metadata events for GRPC-denied events. If the verifier passed, it would try to write the verification record, but referencing a non-existent event, which would fail with a SQL constraint error.
This commit is contained in:
parent
afbd7559e8
commit
d73cde2844
18
src/db.rs
18
src/db.rs
@ -281,15 +281,6 @@ pub async fn db_writer(
|
||||
}
|
||||
}
|
||||
|
||||
// send any metadata events to the NIP-05 verifier
|
||||
if nip05_active && event.is_kind_metadata() {
|
||||
// we are sending this prior to even deciding if we
|
||||
// persist it. this allows the nip05 module to
|
||||
// inspect it, update if necessary, or persist a new
|
||||
// event and broadcast it itself.
|
||||
metadata_tx.send(event.clone()).ok();
|
||||
}
|
||||
|
||||
// get a validation result for use in verification and GPRC
|
||||
let validation = if nip05_active {
|
||||
Some(repo.get_latest_user_verification(&event.pubkey).await)
|
||||
@ -390,6 +381,15 @@ pub async fn db_writer(
|
||||
}
|
||||
}
|
||||
|
||||
// send any metadata events to the NIP-05 verifier
|
||||
if nip05_active && event.is_kind_metadata() {
|
||||
// we are sending this prior to even deciding if we
|
||||
// persist it. this allows the nip05 module to
|
||||
// inspect it, update if necessary, or persist a new
|
||||
// event and broadcast it itself.
|
||||
metadata_tx.send(event.clone()).ok();
|
||||
}
|
||||
|
||||
// TODO: cache recent list of authors to remove a DB call.
|
||||
let start = Instant::now();
|
||||
if event.is_ephemeral() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user