diff --git a/damus/ContentView.swift b/damus/ContentView.swift index d336143b..03df09ec 100644 --- a/damus/ContentView.swift +++ b/damus/ContentView.swift @@ -372,6 +372,12 @@ struct ContentView: View { 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 let ev = make_metadata_event(keypair: keypair, metadata: profile) ds.postbox.send(ev) diff --git a/damus/Nostr/Profiles.swift b/damus/Nostr/Profiles.swift index fa3f06d3..cf30d1fa 100644 --- a/damus/Nostr/Profiles.swift +++ b/damus/Nostr/Profiles.swift @@ -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) +}