nwc: clear the zapper cache for our pubkey when we attach a new wallet
This commit is contained in:
@@ -372,6 +372,12 @@ struct ContentView: View {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear zapper cache for old lud16
|
||||||
|
if profile.lud16 != nil {
|
||||||
|
// TODO: should this be somewhere else, where we process profile events!?
|
||||||
|
invalidate_zapper_cache(pubkey: keypair.pubkey, profiles: ds.profiles, lnurl: ds.lnurls)
|
||||||
|
}
|
||||||
|
|
||||||
profile.lud16 = lud16
|
profile.lud16 = lud16
|
||||||
let ev = make_metadata_event(keypair: keypair, metadata: profile)
|
let ev = make_metadata_event(keypair: keypair, metadata: profile)
|
||||||
ds.postbox.send(ev)
|
ds.postbox.send(ev)
|
||||||
|
|||||||
@@ -52,3 +52,9 @@ class Profiles {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func invalidate_zapper_cache(pubkey: String, profiles: Profiles, lnurl: LNUrls) {
|
||||||
|
profiles.zappers.removeValue(forKey: pubkey)
|
||||||
|
lnurl.endpoints.removeValue(forKey: pubkey)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user