From a77fe6ca00a1ae3e82e64904e31bc9d25a351492 Mon Sep 17 00:00:00 2001 From: kernelkind Date: Mon, 16 Jun 2025 17:18:27 -0400 Subject: [PATCH] unknowns: use unowned noteid instead of owned Signed-off-by: kernelkind --- crates/notedeck/src/unknowns.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/notedeck/src/unknowns.rs b/crates/notedeck/src/unknowns.rs index ed708977..c51bdf5f 100644 --- a/crates/notedeck/src/unknowns.rs +++ b/crates/notedeck/src/unknowns.rs @@ -191,7 +191,7 @@ impl UnknownIds { pub fn add_unknown_id_if_missing(&mut self, ndb: &Ndb, txn: &Transaction, unk_id: &UnknownId) { match unk_id { UnknownId::Pubkey(pk) => self.add_pubkey_if_missing(ndb, txn, pk), - UnknownId::Id(note_id) => self.add_note_id_if_missing(ndb, txn, note_id), + UnknownId::Id(note_id) => self.add_note_id_if_missing(ndb, txn, note_id.bytes()), } } @@ -205,13 +205,15 @@ impl UnknownIds { self.mark_updated(); } - pub fn add_note_id_if_missing(&mut self, ndb: &Ndb, txn: &Transaction, note_id: &NoteId) { + pub fn add_note_id_if_missing(&mut self, ndb: &Ndb, txn: &Transaction, note_id: &[u8; 32]) { // we already have this note, skip - if ndb.get_note_by_id(txn, note_id.bytes()).is_ok() { + if ndb.get_note_by_id(txn, note_id).is_ok() { return; } - self.ids.entry(UnknownId::Id(*note_id)).or_default(); + self.ids + .entry(UnknownId::Id(NoteId::new(*note_id))) + .or_default(); self.mark_updated(); } }