What is the best way to get the exact relays that an event was received from in rust-nostr?

I am using fetch_events() then process/filter them.

After the fetch and processing I want to add relay hints to event id-s when I am constructing my kind 5300 #dvm responses.

cc nostr:nprofile1qqsx3kq3vkgczq9hmfplc28h687py42yvms3zkyxh8nmkvn0vhkyyuspz4mhxue69uhkummnw3ezummcw3ezuer9wchsz9thwden5te0wfjkccte9ejxzmt4wvhxjme0qy88wumn8ghj7mn0wvhxcmmv9u0uehfp

#rust #asknostr #rustnostr

Reply to this note

Please Login to reply.

Discussion

There is a method on the database that allow to check where an event ID was seen:

```rust

let database = client.database();

let relays = database.event_seen_on_relays(id).await?;

```

This works with the in-memory database (which is used by default) and with some persistent database but not with all implementations (like with nostrdb).

Another good solution is to use the `RelayPoolNotification`, like suggested by nostr:nprofile1qqswgvmv65ja7706f5a0xe8ajcqdfvgdeeppt2jvx0kh06sggg6ykyqppemhxue69uhkummn9ekx7mp0qys8wumn8ghj7mn0wd68ytn9d9h82mny0fmkzmn6d9njuumsv93k2tcpr4mhxue69uhkummnw3ezucnfw33k76twv4ezuum0vd5kzmp0v9ru2a

Ah great I'll look into that too, thanks a lot!

I found event_seen_on_relays() fn I think it'll do the job. Great!