From d04b155e118403eaf3d8cb6cf61a25af709a4f90 Mon Sep 17 00:00:00 2001 From: Overtorment Date: Fri, 1 Feb 2019 19:06:47 +0000 Subject: [PATCH] FIX: can pay negative free amount invoices --- controllers/api.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controllers/api.js b/controllers/api.js index dba719d..189d70c 100644 --- a/controllers/api.js +++ b/controllers/api.js @@ -112,7 +112,10 @@ router.post('/payinvoice', async function(req, res) { if (!req.body.invoice) return errorBadArguments(res); let freeAmount = false; - if (req.body.amount) freeAmount = parseInt(req.body.amount); + if (req.body.amount) { + freeAmount = parseInt(req.body.amount); + if (freeAmount <= 0) return errorBadArguments(res); + } // obtaining a lock let lock = new Lock(redis, 'invoice_paying_for_' + u.getUserId());