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:
@@ -85,8 +85,8 @@ class Profiles {
|
||||
ndb.search_profile(query, limit: limit, txn: txn)
|
||||
}
|
||||
|
||||
func lookup(id: Pubkey) -> NdbTxn<Profile?>? {
|
||||
guard let txn = ndb.lookup_profile(id) else {
|
||||
func lookup(id: Pubkey, txn_name: String? = nil) -> NdbTxn<Profile?>? {
|
||||
guard let txn = ndb.lookup_profile(id, txn_name: txn_name) else {
|
||||
return nil
|
||||
}
|
||||
return txn.map({ pr in pr?.profile })
|
||||
|
||||
Reference in New Issue
Block a user