new block handler logs
This commit is contained in:
parent
6e8a181d34
commit
8ada2ac165
2 changed files with 4 additions and 1 deletions
|
|
@ -161,6 +161,7 @@ export default class {
|
||||||
NewBlockHandler = async (height: number, skipMetrics?: boolean) => {
|
NewBlockHandler = async (height: number, skipMetrics?: boolean) => {
|
||||||
let confirmed: (PendingTx & { confs: number; })[]
|
let confirmed: (PendingTx & { confs: number; })[]
|
||||||
let log = getLogger({})
|
let log = getLogger({})
|
||||||
|
log("NewBlockHandler called", JSON.stringify({ height, skipMetrics }))
|
||||||
this.storage.paymentStorage.DeleteExpiredTransactionSwaps(height)
|
this.storage.paymentStorage.DeleteExpiredTransactionSwaps(height)
|
||||||
.catch(err => log(ERROR, "failed to delete expired transaction swaps", err.message || err))
|
.catch(err => log(ERROR, "failed to delete expired transaction swaps", err.message || err))
|
||||||
this.storage.paymentStorage.DeleteExpiredInvoiceSwaps(height)
|
this.storage.paymentStorage.DeleteExpiredInvoiceSwaps(height)
|
||||||
|
|
@ -176,6 +177,7 @@ export default class {
|
||||||
log(ERROR, "failed to check transactions after new block", err.message || err)
|
log(ERROR, "failed to check transactions after new block", err.message || err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
log("NewBlockHandler new confirmed transactions", confirmed.length)
|
||||||
await Promise.all(confirmed.map(async c => {
|
await Promise.all(confirmed.map(async c => {
|
||||||
if (c.type === 'outgoing') {
|
if (c.type === 'outgoing') {
|
||||||
await this.storage.paymentStorage.UpdateUserTransactionPayment(c.tx.serial_id, { confs: c.confs })
|
await this.storage.paymentStorage.UpdateUserTransactionPayment(c.tx.serial_id, { confs: c.confs })
|
||||||
|
|
|
||||||
|
|
@ -980,7 +980,8 @@ export default class {
|
||||||
const pending = await this.storage.paymentStorage.GetPendingTransactions()
|
const pending = await this.storage.paymentStorage.GetPendingTransactions()
|
||||||
let lowestHeight = height
|
let lowestHeight = height
|
||||||
const map: Record<string, PendingTx> = {}
|
const map: Record<string, PendingTx> = {}
|
||||||
|
let log = getLogger({})
|
||||||
|
log("CheckNewlyConfirmedTxs ", pending.incoming.length, "incoming", pending.outgoing.length, "outgoing")
|
||||||
const checkTx = (t: PendingTx) => {
|
const checkTx = (t: PendingTx) => {
|
||||||
if (t.tx.broadcast_height < lowestHeight) { lowestHeight = t.tx.broadcast_height }
|
if (t.tx.broadcast_height < lowestHeight) { lowestHeight = t.tx.broadcast_height }
|
||||||
map[t.tx.tx_hash] = t
|
map[t.tx.tx_hash] = t
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue