aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-12-23 00:26:26 +0000
committerAdam Soltys <[email protected]>2023-12-23 00:26:31 +0000
commita89b891a3311104f2cc34d75d97b84774924befa (patch)
treedb4aa0b3d69d44311eea5ba2f515039aa5e40b9e
parentfbf27aaeb56cabc004c30215832126c98e7e4c6a (diff)
downloadcoinos-server-a89b891a3311104f2cc34d75d97b84774924befa.tar.gz
coinos-server-a89b891a3311104f2cc34d75d97b84774924befa.zip
cltv default
-rw-r--r--lib/invoices.js3
-rw-r--r--lib/lightning.js2
-rw-r--r--lib/payments.js14
3 files changed, 10 insertions, 9 deletions
diff --git a/lib/invoices.js b/lib/invoices.js
index 0cf2d72b..23af1aa4 100644
--- a/lib/invoices.js
+++ b/lib/invoices.js
@@ -46,6 +46,7 @@ export let generate = async ({ invoice, user, sender, memo }) => {
description: memo || "",
expiry: expiry || 60 * 60 * 24 * 30,
deschashonly: true,
+ cltv: 19
});
hash = r.bolt11;
@@ -79,7 +80,7 @@ export let generate = async ({ invoice, user, sender, memo }) => {
webhook,
};
- l(type, "invoice", user.username, amount);
+ if (!user.username === 'lightningins') l(type, "invoice", user.username, amount);
await s(`invoice:${hash}`, id);
await s(`invoice:${id}`, invoice);
diff --git a/lib/lightning.js b/lib/lightning.js
index 8bde9633..9400a449 100644
--- a/lib/lightning.js
+++ b/lib/lightning.js
@@ -25,8 +25,6 @@ export async function listenForLightning() {
let received = Math.round(amount_received_msat / 1000);
try {
- l("incoming lightning payment", received);
-
if (!preimage) return;
let id = await g(`invoice:${bolt11}`);
diff --git a/lib/payments.js b/lib/payments.js
index c76bea70..92cd0760 100644
--- a/lib/payments.js
+++ b/lib/payments.js
@@ -70,7 +70,7 @@ export let debit = async ({
amount || 0,
tip || 0,
fee || 0,
- ourfee || 0,
+ ourfee || 0
);
if (r !== "ok") fail("Problem debiting account");
@@ -133,7 +133,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
if (Math.abs(invoice.rate / store.rates[invoice.currency] - 1) < 0.01) {
rate = equivalentRate;
} else {
- warn("rate slipped", hash, invoice.rate, equivalentRate);
+ // warn("rate slipped", hash, invoice.rate, equivalentRate);
}
let id = v4();
@@ -176,7 +176,9 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
.incrBy(`${balance}:${uid}`, amount)
.exec();
- l("received", type, username, amount, tip);
+ if (!username.startsWith("lightning"))
+ l(username, "received", type, amount, tip);
+
emit(uid, "payment", p);
notify(user, `Received ${amount} sats`);
callWebhook(invoice, p);
@@ -187,7 +189,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
sats:
"⚡️" +
new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }).format(
- p.amount,
+ p.amount
),
link: `${process.env.URL}/payment/${p.id}`,
});
@@ -195,12 +197,12 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
mqtt1.publish(
username,
- `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}`,
+ `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}`
);
mqtt2.publish(
username,
- `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}`,
+ `pay:${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}`
);
return p;