notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit a77fe6ca00a1ae3e82e64904e31bc9d25a351492
parent 6da10c4fafec2e7df770d4267d4ec51d4de9ab42
Author: kernelkind <kernelkind@gmail.com>
Date:   Mon, 16 Jun 2025 17:18:27 -0400

unknowns: use unowned noteid instead of owned

Signed-off-by: kernelkind <kernelkind@gmail.com>

Diffstat:
Mcrates/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 @@ -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(); } }