unknowns: use unowned noteid instead of owned
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -191,7 +191,7 @@ impl UnknownIds {
|
|||||||
pub fn add_unknown_id_if_missing(&mut self, ndb: &Ndb, txn: &Transaction, unk_id: &UnknownId) {
|
pub fn add_unknown_id_if_missing(&mut self, ndb: &Ndb, txn: &Transaction, unk_id: &UnknownId) {
|
||||||
match unk_id {
|
match unk_id {
|
||||||
UnknownId::Pubkey(pk) => self.add_pubkey_if_missing(ndb, txn, pk),
|
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();
|
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
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.ids.entry(UnknownId::Id(*note_id)).or_default();
|
self.ids
|
||||||
|
.entry(UnknownId::Id(NoteId::new(*note_id)))
|
||||||
|
.or_default();
|
||||||
self.mark_updated();
|
self.mark_updated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user