diff options
| author | Adam Soltys <[email protected]> | 2020-07-06 10:46:52 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-07-06 10:46:52 -0700 |
| commit | c602ce9e859eb4b5dba0477b325a1106fc1913ad (patch) | |
| tree | 1b271ad8c1ff24a7a05f7bdadeab69b27198b3ad | |
| parent | 9306393fbe1de9840e75f6a6738b99418fafb50f (diff) | |
| download | coinos-server-c602ce9e859eb4b5dba0477b325a1106fc1913ad.tar.gz coinos-server-c602ce9e859eb4b5dba0477b325a1106fc1913ad.zip | |
fix withdrawal limits
| -rw-r--r-- | routes/lnurl.js | 13 |
1 files 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; |
