aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-07-06 10:46:52 -0700
committerAdam Soltys <[email protected]>2020-07-06 10:46:52 -0700
commitc602ce9e859eb4b5dba0477b325a1106fc1913ad (patch)
tree1b271ad8c1ff24a7a05f7bdadeab69b27198b3ad
parent9306393fbe1de9840e75f6a6738b99418fafb50f (diff)
downloadcoinos-server-c602ce9e859eb4b5dba0477b325a1106fc1913ad.tar.gz
coinos-server-c602ce9e859eb4b5dba0477b325a1106fc1913ad.zip
fix withdrawal limits
-rw-r--r--routes/lnurl.js13
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;