This commit is contained in:
boufni95 2025-04-16 17:41:40 +00:00
parent 2879517c92
commit a6aef23df1
2 changed files with 1 additions and 4 deletions

View file

@ -114,12 +114,11 @@ export default class {
NewBlockHandler = async (height: number) => { NewBlockHandler = async (height: number) => {
let confirmed: (PendingTx & { confs: number; })[] let confirmed: (PendingTx & { confs: number; })[]
let log = getLogger({}) let log = getLogger({})
log("checking new block", height)
try { try {
const balanceEvents = await this.paymentManager.GetLndBalance() const balanceEvents = await this.paymentManager.GetLndBalance()
await this.metricsManager.NewBlockCb(height, balanceEvents) await this.metricsManager.NewBlockCb(height, balanceEvents)
confirmed = await this.paymentManager.CheckNewlyConfirmedTxs(height) confirmed = await this.paymentManager.CheckNewlyConfirmedTxs(height)
log("checked newly confirmed transactions", confirmed)
await this.liquidityManager.onNewBlock() await this.liquidityManager.onNewBlock()
} catch (err: any) { } catch (err: any) {
log(ERROR, "failed to check transactions after new block", err.message || err) log(ERROR, "failed to check transactions after new block", err.message || err)

View file

@ -211,11 +211,9 @@ export default class {
} }
const existingAddress = await this.storage.paymentStorage.GetExistingUserAddress(ctx.user_id, app) const existingAddress = await this.storage.paymentStorage.GetExistingUserAddress(ctx.user_id, app)
if (existingAddress) { if (existingAddress) {
this.log("returning existing address", existingAddress.address)
return { address: existingAddress.address } return { address: existingAddress.address }
} }
const res = await this.lnd.NewAddress(req.addressType, { useProvider: false, from: 'user' }) const res = await this.lnd.NewAddress(req.addressType, { useProvider: false, from: 'user' })
this.log("generated new address", res.address)
const userAddress = await this.storage.paymentStorage.AddUserAddress(user, res.address, { linkedApplication: app }) const userAddress = await this.storage.paymentStorage.AddUserAddress(user, res.address, { linkedApplication: app })
this.storage.eventsLog.LogEvent({ type: 'new_address', userId: user.user_id, appUserId: "", appId: app.app_id, balance: user.balance_sats, data: res.address, amount: 0 }) this.storage.eventsLog.LogEvent({ type: 'new_address', userId: user.user_id, appUserId: "", appId: app.app_id, balance: user.balance_sats, data: res.address, amount: 0 })
return { address: userAddress.address } return { address: userAddress.address }