aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/payments.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/payments.js b/lib/payments.js
index 461b07c1..7d8bafb0 100644
--- a/lib/payments.js
+++ b/lib/payments.js
@@ -222,6 +222,7 @@ export let autowithdraw = async (user) => {
let to = destination.trim();
let balance = await g(`balance:${id}`);
let amount = balance - reserve;
+ console.log("AMT", amount, balance, reserve, threshold);
if (balance > threshold) await pay({ amount, to, user });
}
} catch (e) {
@@ -245,12 +246,10 @@ let pay = async ({ amount, to, user }) => {
if (lnurl) {
amount -= maxfee;
let { callback } = await got(lnurl).json();
- ({ pr } = await got(`${callback}?amount=${amount}`).json());
+ ({ pr } = await got(`${callback}?amount=${amount * 1000}`).json());
} else if (to.startsWith("ln")) {
- try {
- await ln.decode(to);
+ amount -= maxfee;
pr = to;
- } catch (e) {}
}
if (pr) await sendLightning({ user, pr, amount, maxfee });