From c602ce9e859eb4b5dba0477b325a1106fc1913ad Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 6 Jul 2020 10:46:52 -0700 Subject: fix withdrawal limits --- routes/lnurl.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/routes/lnurl.js b/routes/lnurl.js index 8fb79874..fad15ffe 100644 --- a/routes/lnurl.js +++ b/routes/lnurl.js @@ -18,8 +18,8 @@ app.get("/withdraw", auth, async (req, res) => { const { min, max } = req.query; try { const result = await lnurlServer.generateNewUrl("withdrawRequest", { - minWithdrawable: min, - maxWithdrawable: max, + minWithdrawable: min * 1000, + maxWithdrawable: max * 1000, defaultDescription: "coinos withdrawal", }); @@ -112,8 +112,13 @@ lnurlServer.bindToHook( return next(); } - user = withdrawals[k1]; - if (user && pr) { + if (pr) { + user = withdrawals[k1]; + if (!user) { + if (next) next(new Error("withdrawal not found")); + return; + } + try { let decoded = await lna.decodePayReq({ pay_req: pr }); let amount = decoded.num_satoshis; -- cgit v1.2.3