diff options
| -rw-r--r-- | lib/payments.ts | 7 | ||||
| -rw-r--r-- | routes/nostr.ts | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/payments.ts b/lib/payments.ts index 705245e8..a073bec7 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -512,6 +512,7 @@ export let sendLightning = async ({ if (pays.find((p) => p.status === "pending")) fail("Payment is already underway"); + await db.sAdd("pending", pr); p = await debit({ hash: pr, amount: total, @@ -533,8 +534,10 @@ export let sendLightning = async ({ }); try { - if (r.status === "complete") p = await finalize(r, p); - else await db.sAdd("pending", pr); + if (r.status === "complete") { + p = await finalize(r, p); + await db.sRem("pending", pr); + } } catch (e) { console.log("failed to process payment", e, p); } diff --git a/routes/nostr.ts b/routes/nostr.ts index ddec8803..99b2a5c3 100644 --- a/routes/nostr.ts +++ b/routes/nostr.ts @@ -85,7 +85,7 @@ export default { await s(`${pubkeys}:pubkeys`, pubkeys); } - if (!pubkeys.length || pubkeysOnly) return res.send(pubkeys); + if (!pubkeys.length || pubkeysOnly) return res.send(pubkeys); let cache = await g(`${pubkey}:follows`); if (cache && cache.t >= created_at) ({ follows } = cache); |
