From 2ea66724f331d4f24a0ca83a91ef90c27ed07353 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 25 May 2026 12:59:00 -0700 Subject: sendLightning / finalize: drop chatty per-send INFO logs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each successful lightning send was emitting 5 INFO lines: " sent lightning " (debit, KEEP) "paying lightning invoice " (drop — redundant) "payment completed " (drop — implicit from absence of warns) "refunding fee " (drop — the warn for non-integer delta already covers anomalies) "sendLightning outcome = finalized" (drop for "finalized" only — keep for the recovery-via-fallback variants since those are diagnostic) Net: only the " sent lightning " line fires per healthy send, matching the other asset types' style. Anything that needed a fallback path or threw still surfaces via the existing warn/err lines. Co-Authored-By: Claude Opus 4.7 (1M context) --- lib/payments.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/payments.ts b/lib/payments.ts index 96469534..52434739 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -689,8 +689,6 @@ export const sendLightning = async ({ await db.sAdd("pending", pr); - l("paying lightning invoice", pr.substr(-8), amount, fee); - // Instrumentation: track which exit path the payment took so we can // diagnose any future stuck "optimistic" cases (confirmed=true with no // ref, no pending-set membership). Logged just before the function @@ -804,7 +802,13 @@ export const sendLightning = async ({ const persisted = await g(`payment:${p.id}`); const refInDb = !!persisted?.ref; if (refInDb || finalizedOutcomes.has(outcome)) { - l("sendLightning outcome", p.id, "=", outcome, refInDb && !finalizedOutcomes.has(outcome) ? "(ref set in db despite throw)" : ""); + // Only log when the outcome wasn't the boring success case — every + // payment goes through "finalized" so logging it is just noise. The + // recovery-via-fallback variants (finalized-via-listpays-*, etc.) are + // worth knowing about, so emit those. + if (outcome !== "finalized") { + l("sendLightning outcome", p.id, "=", outcome, refInDb && !finalizedOutcomes.has(outcome) ? "(ref set in db despite throw)" : ""); + } } else if (safeNonFinalized.has(outcome)) { warn("sendLightning outcome", p.id, "=", outcome); } else { @@ -1053,7 +1057,6 @@ const finalize = async (r, p) => { if (!preimage) fail("missing preimage"); await db.sRem("pending", p.hash); - l("payment completed", p.id, r.payment_preimage); nwcNotify(p); const maxfee = p.fee; @@ -1080,7 +1083,6 @@ const finalize = async (r, p) => { await s(`payment:${p.id}`, p); const refund = maxfee - p.fee; if (Number.isFinite(refund) && Number.isInteger(refund)) { - l("refunding fee", maxfee, p.fee, refund, p.ref); await db.incrBy(`balance:${p.uid}`, refund); } else { warn("finalize: skipping fee refund (non-integer delta)", p.id, -- cgit v1.2.3