commit 1518a0a16c7ac0fbe3b790173047b5fc28e02c37 parent dafa1ba4debbe8055a1ee7e6900079fbc9a4224c Author: William Casarin <jb55@jb55.com> Date: Sat, 13 May 2023 19:51:06 -0700 zaps: ensure returned bolt11 is the correct amount Diffstat:
M | damus/Util/Zap.swift | | | 7 | +++++++ |
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/damus/Util/Zap.swift b/damus/Util/Zap.swift @@ -293,5 +293,12 @@ func fetch_zap_invoice(_ payreq: LNUrlPayRequest, zapreq: NostrEvent?, sats: Int return nil } + // make sure it's the correct amount + guard let bolt11 = decode_bolt11(result.pr), + .specific(amount) == bolt11.amount + else { + return nil + } + return result.pr }