This commit is contained in:
hatim boufnichel 2024-03-16 16:39:35 +01:00
parent 8918703204
commit 765f488f09
4 changed files with 6 additions and 0 deletions

View file

@ -43,3 +43,4 @@ MIGRATE_DB=false
#METRICS
RECORD_PERFORMANCE=true
SKIP_SANITY_CHECK=false
DISABLE_EXTERNAL_PAYMENTS=false

View file

@ -34,6 +34,7 @@ export const LoadMainSettingsFromEnv = (test = false): MainSettings => {
servicePort: EnvMustBeInteger("PORT"),
recordPerformance: process.env.RECORD_PERFORMANCE === 'true' || false,
skipSanityCheck: process.env.SKIP_SANITY_CHECK === 'true' || false,
disableExternalPayments: process.env.DISABLE_EXTERNAL_PAYMENTS === 'true' || false
}
}

View file

@ -149,6 +149,9 @@ export default class {
const internalInvoice = await this.storage.paymentStorage.GetInvoiceOwner(req.invoice)
let payment: PaidInvoice | null = null
if (!internalInvoice) {
if (this.settings.disableExternalPayments) {
throw new Error("something went wrong sending payment, please try again later")
}
this.log("paying external invoice", req.invoice)
const routingFeeLimit = this.lnd.GetFeeLimitAmount(payAmount)
await this.storage.userStorage.DecrementUserBalance(userId, totalAmountToDecrement + routingFeeLimit, req.invoice)

View file

@ -16,5 +16,6 @@ export type MainSettings = {
servicePort: number
recordPerformance: boolean
skipSanityCheck: boolean
disableExternalPayments: boolean
}