damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit bb32d72903dead180dbafab22248435202fd649e
parent f77a7bcb29d50b8a73121c4a12441bb1c6806306
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 10 May 2023 13:23:56 -0700

nwc: clear the zapper cache for our pubkey when we attach a new wallet

Diffstat:
Mdamus/ContentView.swift | 6++++++
Mdamus/Nostr/Profiles.swift | 6++++++
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git 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 @@ -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) +}