damus

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

commit 006a6ef16fda1a16716c927a731e74a6d7c57ee7
parent 7467a9d5b1380d8b200cdf4b11ae36520630b604
Author: William Casarin <jb55@jb55.com>
Date:   Thu, 10 Aug 2023 10:32:57 -0700

Show possibly invalid zaps if we don't have the event in cache

Changelog-Fixed: Fix zaps sometimes not appearing

Diffstat:
Mdamus/Models/HomeModel.swift | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/damus/Models/HomeModel.swift b/damus/Models/HomeModel.swift @@ -1347,7 +1347,17 @@ func get_zap_target_pubkey(ev: NostrEvent, events: EventCache) -> Pubkey? { } // we can't trust the p tag on note zaps because they can be faked - return events.lookup(etag)?.pubkey + guard let pk = events.lookup(etag)?.pubkey else { + // We don't have the event in cache so we can't check the pubkey. + + // We could return this as an invalid zap but that wouldn't be correct + // all of the time, and may reject valid zaps. What we need is a new + // unvalidated zap state, but for now we simply leak a bit of correctness... + + return ev.referenced_pubkeys.just_one() + } + + return pk } func process_zap_event(damus_state: DamusState, ev: NostrEvent, completion: @escaping (ProcessZapResult) -> Void) {