rust-nostr / nostr

Nostr protocol implementation, high-level client library, Nostr Wallet Connect, bindings and more.
https://rust-nostr.org/
MIT License
424 stars 94 forks source link

Discovery flag need more clarification #596

Closed reyamir closed 3 weeks ago

reyamir commented 3 weeks ago

Describe the enhancement
I'm not sure this is a bug or just missing feature, when checking source code, I see a note about DISCOVERY flag for relay like this:

/// DISCOVERY means that relay has role to get metadata (i.e. events with kind 0 or 10002) of public keys
pub const DISCOVERY: Self = Self(1 << 5); // 32

But when query user's metadata, it only query from user's relays

2024-10-29T02:26:18.410230Z  INFO nostr_sdk::client::handler: Spawned client notification handler
2024-10-29T02:26:19.111540Z  INFO nostr_relay_pool::relay::inner: Connected to 'wss://relay.damus.io/'
2024-10-29T02:26:19.408644Z  INFO nostr_relay_pool::relay::inner: Connected to 'wss://purplepag.es/'
2024-10-29T02:26:20.307447Z  INFO nostr_relay_pool::relay::inner: Connected to 'wss://relay.nostr.net/'
2024-10-29T02:26:20.721583Z  INFO nostr_relay_pool::relay::inner: Connected to 'wss://relay.primal.net/'
Metadata: Metadata { name: Some("reya"), display_name: Some("reya"), about: Some("Interests:\n- Anime, manga and manhwa.\n- Game, mostly played RPG and 4X games, sometime played eroge.\nBuilding:\n- Lume: https://github.com/lumehq/lume\n- Coop: https://github.com/lumehq/coop"), website: Some("https://reya.su/"), picture: Some("https://image.nostr.build/9326c5eeea6eaa34de92df803e98b4970c6a8e19fcc6186d311d607d52a89368.jpg"), banner: None, nip05: Some("_@reya.su"), lud06: None, lud16: Some("reya@getalby.com"), custom: {"pubkey": String("126103bfddc8df256b6e0abfd7f3797c80dcc4ea88f7c2f87dd4104220b4d65f"), "displayName": String("reya")} }
Seen on: wss://relay.damus.io/
Seen on: wss://relay.nostr.net/
2024-10-29T02:26:20.962022Z  INFO nostr_relay_pool::pool::inner: Relay pool shutdown

Repo: https://github.com/reyamir/rust-nostr-debug

yukibtc commented 3 weeks ago

Thanks, I'll fix the doc. DISCOVERY relays are used only to query relays of users. All users related events will come from READ (the manually set relays) or INBOX relays.