1
0
mirror of git://jb55.com/damus synced 2024-09-18 19:23:49 +00:00

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

Changelog-Fixed: Fix zaps sometimes not appearing
This commit is contained in:
William Casarin 2023-08-10 10:32:57 -07:00
parent 7467a9d5b1
commit 006a6ef16f

View File

@ -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) {