aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-05-25 12:59:00 -0700
committerAdam Soltys <[email protected]>2026-05-25 12:59:00 -0700
commit2ea66724f331d4f24a0ca83a91ef90c27ed07353 (patch)
tree4ae3c03969ed237c5d36964ca5cea2ea48c3160a
parentcaebad1dd85188f4315751c6ce77f92d7a1588c2 (diff)
downloadcoinos-server-2ea66724f331d4f24a0ca83a91ef90c27ed07353.tar.gz
coinos-server-2ea66724f331d4f24a0ca83a91ef90c27ed07353.zip
sendLightning / finalize: drop chatty per-send INFO logs
Each successful lightning send was emitting 5 INFO lines: "<user> sent lightning <amount>" (debit, KEEP) "paying lightning invoice <pr> <amt> <fee>" (drop — redundant) "payment completed <id> <preimage>" (drop — implicit from absence of warns) "refunding fee <maxfee> <fee> <delta> <ref>" (drop — the warn for non-integer delta already covers anomalies) "sendLightning outcome <id> = finalized" (drop for "finalized" only — keep for the recovery-via-fallback variants since those are diagnostic) Net: only the "<user> sent lightning <amount>" 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) <[email protected]>
-rw-r--r--lib/payments.ts12
1 files 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,