Merge pull request #884 from shocknet/new-block-logs

new block handler logs
This commit is contained in:
Justin (shocknet) 2026-02-19 17:25:13 -05:00 committed by GitHub
commit 6aa90d63ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -161,6 +161,7 @@ export default class {
NewBlockHandler = async (height: number, skipMetrics?: boolean) => {
let confirmed: (PendingTx & { confs: number; })[]
let log = getLogger({})
log("NewBlockHandler called", JSON.stringify({ height, skipMetrics }))
this.storage.paymentStorage.DeleteExpiredTransactionSwaps(height)
.catch(err => log(ERROR, "failed to delete expired transaction swaps", err.message || err))
this.storage.paymentStorage.DeleteExpiredInvoiceSwaps(height)
@ -176,6 +177,7 @@ export default class {
log(ERROR, "failed to check transactions after new block", err.message || err)
return
}
log("NewBlockHandler new confirmed transactions", confirmed.length)
await Promise.all(confirmed.map(async c => {
if (c.type === 'outgoing') {
await this.storage.paymentStorage.UpdateUserTransactionPayment(c.tx.serial_id, { confs: c.confs })

View file

@ -980,7 +980,8 @@ export default class {
const pending = await this.storage.paymentStorage.GetPendingTransactions()
let lowestHeight = height
const map: Record<string, PendingTx> = {}
let log = getLogger({})
log("CheckNewlyConfirmedTxs ", pending.incoming.length, "incoming", pending.outgoing.length, "outgoing")
const checkTx = (t: PendingTx) => {
if (t.tx.broadcast_height < lowestHeight) { lowestHeight = t.tx.broadcast_height }
map[t.tx.tx_hash] = t