perf: coordinate unknown id lookups
This is a huge improvement over what it was before. Now all unknown id lookups are debounced and happen through a central coordinator. This ensures there is no duplication between timelines. Fixes: https://github.com/damus-io/notedeck/issues/279 Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -16,7 +16,7 @@ impl Keypair {
|
||||
let cloned_secret_key = secret_key.clone();
|
||||
let nostr_keys = nostr::Keys::new(secret_key);
|
||||
Keypair {
|
||||
pubkey: Pubkey::new(&nostr_keys.public_key().to_bytes()),
|
||||
pubkey: Pubkey::new(nostr_keys.public_key().to_bytes()),
|
||||
secret_key: Some(cloned_secret_key),
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ impl FullKeypair {
|
||||
let (xopk, _) = secret_key.x_only_public_key(&nostr::SECP256K1);
|
||||
let secret_key = nostr::SecretKey::from(*secret_key);
|
||||
FullKeypair {
|
||||
pubkey: Pubkey::new(&xopk.serialize()),
|
||||
pubkey: Pubkey::new(xopk.serialize()),
|
||||
secret_key,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,14 +5,14 @@ use nostr::bech32::Hrp;
|
||||
use std::fmt;
|
||||
use tracing::debug;
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Hash)]
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Copy, Hash)]
|
||||
pub struct Pubkey([u8; 32]);
|
||||
|
||||
static HRP_NPUB: Hrp = Hrp::parse_unchecked("npub");
|
||||
|
||||
impl Pubkey {
|
||||
pub fn new(data: &[u8; 32]) -> Self {
|
||||
Self(*data)
|
||||
pub fn new(data: [u8; 32]) -> Self {
|
||||
Self(data)
|
||||
}
|
||||
|
||||
pub fn hex(&self) -> String {
|
||||
|
||||
Reference in New Issue
Block a user