From 4c9987e1abd7fa34439adc3cbc1d873324c05030 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 8 Feb 2023 20:18:58 +0000 Subject: lnurl fixes --- lib/invoices.js | 4 ++-- lib/payments.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/invoices.js b/lib/invoices.js index dc475a9c..25e211d1 100644 --- a/lib/invoices.js +++ b/lib/invoices.js @@ -9,7 +9,7 @@ import { v4 } from "uuid"; import bc from "$lib/bitcoin"; import ln from "$lib/ln"; -export let generate = async ({ invoice, user, sender }) => { +export let generate = async ({ invoice, user, sender, memo }) => { let { currency, tip, amount, rate, request_id, type } = invoice; amount = parseInt(amount || 0); @@ -31,7 +31,7 @@ export let generate = async ({ invoice, user, sender }) => { let hash, text; if (type === types.lightning) { let amt = amount ? `${amount + tip}sat` : "any"; - let r = await ln.invoice(amt, new Date(), "", 3600); + let r = await ln.invoice(amt, new Date(), memo || "", 3600); hash = r.payment_hash; text = r.bolt11; diff --git a/lib/payments.js b/lib/payments.js index 6fd595d4..db72de86 100644 --- a/lib/payments.js +++ b/lib/payments.js @@ -44,6 +44,7 @@ export let debit = async ( let covered = Math.min(credit, ourfee) || 0; ourfee -= covered; + l("debiting", user.username, balance, amount, ourfee, amount + ourfee); if (balance < amount + ourfee) fail("Insufficient funds"); await db .multi() -- cgit v1.2.3