Skip to content

Commit c09a587

Browse files
fix: prevent double-pay for community withdrawals if confirmed payment payload is missing
1 parent 2758140 commit c09a587

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

jobs/pending_payments.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,22 @@ export const attemptCommunitiesPendingPayments = async (
363363
try {
364364
const status = await getPaymentStatus(pending.payment_request);
365365

366-
if (status.is_confirmed && status.payment) {
366+
if (status.is_confirmed) {
367+
if (!status.payment) {
368+
logger.error(
369+
`Community ${pending.community_id} pending payment confirmed but LND returned no details; ` +
370+
`not marking SUCCESS — needs manual resolution`,
371+
);
372+
pending.paid = true;
373+
pending.is_invoice_expired = true;
374+
pending.last_error = 'CONFIRMED_NO_PAYLOAD';
375+
await pending.save();
376+
// Notify admin (using Telegram bot's admin capability if possible,
377+
// or just generic bot.telegram.sendMessage to an admin ID if available.
378+
// For now, mirroring the logic of failing and continuing.)
379+
continue;
380+
}
381+
367382
const payment = status.payment;
368383
pending.paid = true;
369384
pending.paid_at = new Date();

0 commit comments

Comments
 (0)