fix crash
This commit is contained in:
parent
8f36ae003a
commit
2705d6957e
2 changed files with 10 additions and 4 deletions
|
|
@ -5,7 +5,7 @@ import * as Types from '../../../proto/autogenerated/ts/types.js'
|
|||
import { EnvMustBeInteger, EnvMustBeNonEmptyString } from '../helpers/envParser.js'
|
||||
import ProductManager from './productManager.js'
|
||||
import ApplicationManager from './applicationManager.js'
|
||||
import PaymentManager from './paymentManager.js'
|
||||
import PaymentManager, { PendingTx } from './paymentManager.js'
|
||||
import { MainSettings } from './settings.js'
|
||||
import NewLightningHandler, { LoadLndSettingsFromEnv, LightningHandler } from "../lnd/index.js"
|
||||
import { AddressPaidCb, InvoicePaidCb, NewBlockCb } from "../lnd/settings.js"
|
||||
|
|
@ -73,9 +73,15 @@ export default class {
|
|||
}
|
||||
|
||||
NewBlockHandler = async (height: number) => {
|
||||
const confirmed = await this.paymentManager.CheckPendingTransactions(height)
|
||||
let confirmed: (PendingTx & { confs: number; })[]
|
||||
let log = getLogger({})
|
||||
try {
|
||||
confirmed = await this.paymentManager.CheckPendingTransactions(height)
|
||||
} catch (err: any) {
|
||||
log("failed to check transactions after new block", err)
|
||||
return
|
||||
}
|
||||
await Promise.all(confirmed.map(async c => {
|
||||
|
||||
if (c.type === 'outgoing') {
|
||||
await this.storage.paymentStorage.UpdateUserTransactionPayment(c.tx.serial_id, { confs: c.confs })
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ interface UserOperationInfo {
|
|||
chain_fees?: number
|
||||
confs?: number
|
||||
}
|
||||
type PendingTx = { type: 'incoming', tx: AddressReceivingTransaction } | { type: 'outgoing', tx: UserTransactionPayment }
|
||||
export type PendingTx = { type: 'incoming', tx: AddressReceivingTransaction } | { type: 'outgoing', tx: UserTransactionPayment }
|
||||
const defaultLnurlPayMetadata = `[["text/plain", "lnurl pay to Lightning.pub"]]`
|
||||
const confInOne = 1000 * 1000
|
||||
const confInTwo = 100 * 1000 * 1000
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue