From bcd072efcd66c005f581a53ad29c2398743a7721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Arturo=20Cabral=20Mej=C3=ADa?= Date: Tue, 14 Feb 2023 23:41:09 -0500 Subject: [PATCH] fix: bug unable confirm invoice (#204) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: confirm only if bolt11 is present Signed-off-by: Ricardo Arturo Cabral Mejía * fix: fix double invoice bug. thx mazin * fix: fypo tix on default-settings * fix: use correct dbname on knexfile --------- Signed-off-by: Ricardo Arturo Cabral Mejía --- knexfile.js | 2 +- resources/default-settings.yaml | 2 +- src/controllers/callbacks/zebedee-callback-controller.ts | 2 +- src/controllers/invoices/post-invoice-controller.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/knexfile.js b/knexfile.js index 6546cc4..9554373 100644 --- a/knexfile.js +++ b/knexfile.js @@ -5,7 +5,7 @@ module.exports = { port: process.env.DB_PORT ?? 5432, user: process.env.DB_USER ?? 'postgres', password: process.env.DB_PASSWORD ?? 'postgres', - database: process.env.DB_NAME ?? 'nostr-ts-relay', + database: process.env.DB_NAME ?? 'nostream', }, seeds: { directory: './seeds', diff --git a/resources/default-settings.yaml b/resources/default-settings.yaml index 62bd4c4..4351fd8 100755 --- a/resources/default-settings.yaml +++ b/resources/default-settings.yaml @@ -10,7 +10,7 @@ payments: feeSchedules: admission: - enabled: false - descripton: Admission fee charged per public key in msats (1000 msats = 1 satoshi) + description: Admission fee charged per public key in msats (1000 msats = 1 satoshi) amount: 1000000 whitelists: pubkeys: diff --git a/src/controllers/callbacks/zebedee-callback-controller.ts b/src/controllers/callbacks/zebedee-callback-controller.ts index be54e9c..9320676 100644 --- a/src/controllers/callbacks/zebedee-callback-controller.ts +++ b/src/controllers/callbacks/zebedee-callback-controller.ts @@ -26,7 +26,7 @@ export class ZebedeeCallbackController implements IController { debug('invoice', invoice) try { - if (!invoice.bolt11) { + if (invoice.bolt11) { await this.paymentsService.updateInvoice(invoice) } } catch (error) { diff --git a/src/controllers/invoices/post-invoice-controller.ts b/src/controllers/invoices/post-invoice-controller.ts index 0065ef4..981f5a1 100644 --- a/src/controllers/invoices/post-invoice-controller.ts +++ b/src/controllers/invoices/post-invoice-controller.ts @@ -124,9 +124,9 @@ export class PostInvoiceController implements IController { return } - const minBalance = currentSettings.limits?.event?.pubkey?.minBalance ?? 0n + const minBalance = currentSettings.limits?.event?.pubkey?.minBalance const user = await this.userRepository.findByPubkey(pubkey) - if (user && user.isAdmitted && minBalance > 0n && user.balance >= minBalance) { + if (user && user.isAdmitted && (!minBalance || user.balance >= minBalance)) { response .status(400) .setHeader('content-type', 'text/plain; charset=utf8')