diff --git a/gossip-bin/src/commands.rs b/gossip-bin/src/commands.rs index 4ac8eca6d..14f12e6cc 100644 --- a/gossip-bin/src/commands.rs +++ b/gossip-bin/src/commands.rs @@ -890,7 +890,7 @@ pub fn events_of_pubkey(cmd: Command, mut args: env::Args) -> Result<(), Error> }; let mut filter = Filter::new(); - filter.add_author(&pubkey.into()); + filter.add_author(pubkey); let events = GLOBALS.db().find_events_by_filter(&filter, |_| true)?; for event in &events { @@ -916,7 +916,7 @@ pub fn events_of_pubkey_and_kind(cmd: Command, mut args: env::Args) -> Result<() let mut filter = Filter::new(); filter.add_event_kind(kind); - filter.add_author(&pubkey.into()); + filter.add_author(pubkey); let events = GLOBALS.db().find_events_by_filter(&filter, |_| true)?; for event in &events { diff --git a/gossip-bin/src/ui/wizard/wizard_state.rs b/gossip-bin/src/ui/wizard/wizard_state.rs index 3a76a2ebb..4d0e6342b 100644 --- a/gossip-bin/src/ui/wizard/wizard_state.rs +++ b/gossip-bin/src/ui/wizard/wizard_state.rs @@ -1,5 +1,5 @@ use gossip_lib::{Person, PersonList, Relay, GLOBALS}; -use nostr_types::{Event, EventKind, Filter, PublicKey, PublicKeyHex, RelayUrl}; +use nostr_types::{Event, EventKind, Filter, PublicKey, RelayUrl}; use std::{cell::RefCell, collections::HashSet, rc::Rc}; #[derive(PartialEq, Clone, Copy, Debug)] @@ -90,9 +90,8 @@ impl WizardState { self.has_private_key = GLOBALS.identity.is_unlocked(); if let Some(pk) = self.pubkey { - let pkh: PublicKeyHex = pk.into(); let mut filter = Filter::new(); - filter.add_author(&pkh); + filter.add_author(pk); filter.kinds = vec![EventKind::Metadata]; self.metadata_events = GLOBALS diff --git a/gossip-lib/src/overlord.rs b/gossip-lib/src/overlord.rs index 3c149567f..fb6080c23 100644 --- a/gossip-lib/src/overlord.rs +++ b/gossip-lib/src/overlord.rs @@ -24,7 +24,7 @@ use http::StatusCode; use nostr_types::{ EncryptedPrivateKey, Event, EventKind, EventReference, Filter, Id, IdHex, Metadata, MilliSatoshi, NAddr, NostrBech32, PayRequestData, PreEvent, PrivateKey, Profile, PublicKey, - PublicKeyHex, RelayUrl, Tag, UncheckedUrl, Unixtime, + RelayUrl, Tag, UncheckedUrl, Unixtime, }; use std::collections::HashMap; use std::sync::atomic::Ordering; @@ -1161,7 +1161,7 @@ impl Overlord { let mut filter = Filter::new(); filter.add_event_kind(EventKind::FollowSets); - filter.add_author(&public_key.into()); + filter.add_author(public_key); // Find all local-storage events that define the list let bad_events = GLOBALS.db().find_events_by_filter(&filter, |event| { @@ -2206,7 +2206,7 @@ impl Overlord { NostrBech32::NAddr(ea) => { let mut filter = Filter::new(); filter.add_event_kind(ea.kind); - filter.add_author(&ea.author.into()); + filter.add_author(ea.author); if let Some(event) = GLOBALS .db() @@ -2916,8 +2916,7 @@ impl Overlord { if posted_outbox == RelayTestResult::Pass { let mut filter = Filter::new(); filter.add_event_kind(outbox_event.kind); - let pkh: PublicKeyHex = outbox_event.pubkey.into(); - filter.add_author(&pkh); + filter.add_author(outbox_event.pubkey); filter.since = Some(outbox_event.created_at); let fetch_result = conn @@ -2943,8 +2942,7 @@ impl Overlord { let mut inbox_filter = Filter::new(); inbox_filter.add_event_kind(inbox_event.kind); - let pkh: PublicKeyHex = inbox_event.pubkey.into(); - inbox_filter.add_author(&pkh); + inbox_filter.add_author(inbox_event.pubkey); inbox_filter.since = Some(inbox_event.created_at); // 4. anon_fetched_inbox diff --git a/gossip-lib/src/pending.rs b/gossip-lib/src/pending.rs index 71e3300b8..88e410081 100644 --- a/gossip-lib/src/pending.rs +++ b/gossip-lib/src/pending.rs @@ -5,7 +5,7 @@ use crate::nostr_connect_server::ParsedCommand; use crate::people::PersonList; use crate::relay::Relay; use crate::storage::Storage; -use nostr_types::{EventKind, Filter, PublicKey, PublicKeyHex, RelayList, RelayUrl, Unixtime}; +use nostr_types::{EventKind, Filter, PublicKey, RelayList, RelayUrl, Unixtime}; use parking_lot::RwLock as PRwLock; use parking_lot::RwLockReadGuard as PRwLockReadGuard; use std::collections::hash_map::DefaultHasher; @@ -227,10 +227,8 @@ impl Pending { let t30days = 60 * 60 * 24 * 30; let t90days = 60 * 60 * 24 * 90; - let pkh: PublicKeyHex = mypubkey.into(); - let mut filter = Filter::new(); - filter.add_author(&pkh); + filter.add_author(mypubkey); filter.kinds = vec![EventKind::RelayList]; let relay_lists = GLOBALS.db().find_events_by_filter(&filter, |_| true)?; filter.kinds = vec![EventKind::DmRelayList]; diff --git a/gossip-lib/src/storage/fof.rs b/gossip-lib/src/storage/fof.rs index 744d8ba5e..20f7ed7de 100644 --- a/gossip-lib/src/storage/fof.rs +++ b/gossip-lib/src/storage/fof.rs @@ -4,7 +4,7 @@ use crate::storage::{FollowingsTable, RawDatabase, Storage, Table}; use crate::PersonList; use heed::types::Bytes; use heed::RwTxn; -use nostr_types::{EventKind, Filter, PublicKey, PublicKeyHex}; +use nostr_types::{EventKind, Filter, PublicKey}; use std::sync::Mutex; // Pubkey -> u64 @@ -137,8 +137,7 @@ impl Storage { .iter() .map(|(pk, _private)| pk) { - let pkh: PublicKeyHex = pubkey.into(); - filter.add_author(&pkh); + filter.add_author(*pubkey); } let contact_lists = self.find_events_by_filter(&filter, |_| true)?; diff --git a/gossip-lib/src/storage/mod.rs b/gossip-lib/src/storage/mod.rs index 4b89701fb..1575f0d9f 100644 --- a/gossip-lib/src/storage/mod.rs +++ b/gossip-lib/src/storage/mod.rs @@ -1387,7 +1387,7 @@ impl Storage { let mut filter = Filter::new(); filter.add_event_kind(event.kind); - filter.add_author(&event.pubkey.into()); + filter.add_author(event.pubkey); let existing = self.find_events_by_filter(&filter, |e| { if event.kind.is_parameterized_replaceable() { e.parameter() == event.parameter() @@ -1433,7 +1433,7 @@ impl Storage { let mut filter = Filter::new(); filter.add_event_kind(kind); - filter.add_author(&pubkey.into()); + filter.add_author(pubkey); Ok(self .find_events_by_filter(&filter, |e| {