diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/nwc.ts | 34 | ||||
| -rw-r--r-- | lib/payments.ts | 5 |
2 files changed, 21 insertions, 18 deletions
@@ -45,23 +45,27 @@ export default () => { const uid = await g(pubkey); const user = await g(`user:${uid}`); - const result = await handle(method, params, user); - const payload = JSON.stringify({ result_type: method, ...result }); - content = await nip04.encrypt(sk, pubkey, payload); + try { + const result = await handle(method, params, user); + const payload = JSON.stringify({ result_type: method, ...result }); + content = await nip04.encrypt(sk, pubkey, payload); - let response: UnsignedEvent = { - created_at: Math.floor(Date.now() / 1000), - kind: 23195, - pubkey: serverPubkey, - tags: [ - ["p", pubkey], - ["e", ev.id], - ], - content, - }; + let response: UnsignedEvent = { + created_at: Math.floor(Date.now() / 1000), + kind: 23195, + pubkey: serverPubkey, + tags: [ + ["p", pubkey], + ["e", ev.id], + ], + content, + }; - response = await finalizeEvent(response, sk); - r.send(["EVENT", response]); + response = await finalizeEvent(response, sk); + r.send(["EVENT", response]); + } catch(e) { + err("problem with nwc", user.username, params, e.message); + } } catch (e) { err("problem with nwc", e.message); } diff --git a/lib/payments.ts b/lib/payments.ts index 0f55368f..0ae84f10 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -457,7 +457,6 @@ export const sendLightning = async ({ invstring: pr.replace(/\s/g, "").toLowerCase(), amount_msat: amount_msat ? undefined : amount * 1000, maxfee: maxfee ? maxfee * 1000 : 0, - retry_for: 10, }); try { @@ -737,7 +736,7 @@ const reverse = async (p) => { const ourfee = p.ourfee || 0; const credit = Math.round(total * config.fee) - ourfee; - const k = await db.reverse( + await db.reverse( `payment:${p.id}`, `balance:${p.uid}`, `credit:${types.lightning}:${p.uid}`, @@ -749,5 +748,5 @@ const reverse = async (p) => { p.hash, ); - warn("reversed", k); + warn("reversed", p.hash); }; |
