diff options
Diffstat (limited to 'lib/invoices.js')
| -rw-r--r-- | lib/invoices.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/invoices.js b/lib/invoices.js index f17223aa..814e87d9 100644 --- a/lib/invoices.js +++ b/lib/invoices.js @@ -12,9 +12,11 @@ import ln from "$lib/ln"; export let generate = async ({ invoice, user, sender }) => { let { currency, tip, amount, rate, request_id, type } = invoice; + amount = parseInt(amount); + tip = parseInt(tip || 0); + if (amount < 0) fail("amount out of range"); if (tip > 5 * amount || tip < 0) fail("tip amount out of range"); - tip = tip || 0; if (!user) user = sender; let uid = await g(`user:${user.username}`); |
