txn: fix subtle transaction inheritence bugs
This fixes subtle bugs with transaction inheritence. Since we were not passing the inherited state to moved value, we were sometimes committing transactions more than once. Changelog-Fixed: Fix many nostrdb transaction related crashes
This commit is contained in:
@@ -183,7 +183,7 @@ func attributed_string_attach_icon(_ astr: inout AttributedString, img: UIImage)
|
||||
}
|
||||
|
||||
func getDisplayName(pk: Pubkey, profiles: Profiles) -> String {
|
||||
let profile_txn = profiles.lookup(id: pk)
|
||||
let profile_txn = profiles.lookup(id: pk, txn_name: "getDisplayName")
|
||||
let profile = profile_txn?.unsafeUnownedValue
|
||||
return Profile.displayName(profile: profile, pubkey: pk).username.truncate(maxLength: 50)
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ func generate_local_notification_object(from ev: NostrEvent, state: HeadlessDamu
|
||||
} else if type == .like,
|
||||
state.settings.like_notification,
|
||||
let evid = ev.referenced_ids.last,
|
||||
let txn = state.ndb.lookup_note(evid),
|
||||
let txn = state.ndb.lookup_note(evid, txn_name: "local_notification_like"),
|
||||
let liked_event = txn.unsafeUnownedValue?.to_owned()
|
||||
{
|
||||
let content_preview = render_notification_content_preview(ev: liked_event, profiles: state.profiles, keypair: state.keypair)
|
||||
|
||||
Reference in New Issue
Block a user