diff options
| author | Adam Soltys <[email protected]> | 2023-01-28 00:54:08 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-01-28 00:54:08 -0800 |
| commit | 283ffc9d8442ecbbc85c0c40167cc03f20f64a40 (patch) | |
| tree | 1aa1c4b498e37f2b0668a363c45991e6ee036ac6 /lib/invoices.js | |
| parent | f0543b6d94081f43a265bb9f754a654df9c4268a (diff) | |
| download | coinos-server-283ffc9d8442ecbbc85c0c40167cc03f20f64a40.tar.gz coinos-server-283ffc9d8442ecbbc85c0c40167cc03f20f64a40.zip | |
parse ints
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}`); |
