Skip to content

Commit

Permalink
add an explicit counter for transactions expired with LastValid set t…
Browse files Browse the repository at this point in the history
…o MaxTxnLife
  • Loading branch information
iansuvak committed Nov 15, 2022
1 parent e69f926 commit c17d3f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions data/pools/transactionPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ func (pool *TransactionPool) recomputeBlockEvaluator(committedTxIds map[transact
pool.assemblyMu.Unlock()

next := bookkeeping.MakeBlock(prev)
proto := config.Consensus[next.CurrentProtocol]
pool.numPendingWholeBlocks = 0
hint := pendingCount - int(knownCommitted)
if hint < 0 || int(knownCommitted) < 0 {
Expand Down Expand Up @@ -743,6 +744,10 @@ func (pool *TransactionPool) recomputeBlockEvaluator(committedTxIds map[transact
asmStats.CommittedCount++
stats.RemovedInvalidCount++
case transactions.TxnDeadError:
te := err.(transactions.TxnDeadError)
if proto.MaxTxnLife == uint64(te.LastValid-te.FirstValid) {
asmStats.ExpiredMaxLifeCount++
}
asmStats.ExpiredCount++
stats.ExpiredCount++
case *ledgercore.LeaseInLedgerError:
Expand Down
4 changes: 3 additions & 1 deletion logging/telemetryspec/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type AssembleBlockStats struct {
InvalidCount int // number of transaction groups that are included in a block
MinFeeErrorCount int // number of transactions excluded because the fee is too low
ExpiredCount int // number of transactions removed because of expiration
ExpiredMaxLifeCount int // number of expired transactions with LastValid set to MaxTxnLife
LeaseErrorCount int // number of transactions removed because it has an already used lease
MinFee uint64
MaxFee uint64
Expand Down Expand Up @@ -105,7 +106,8 @@ func (m AssembleBlockStats) String() string {
b.WriteString(fmt.Sprintf("InvalidCount:%d, ", m.InvalidCount))
b.WriteString(fmt.Sprintf("MinFeeErrorCount:%d, ", m.MinFeeErrorCount))
b.WriteString(fmt.Sprintf("ExpiredCount:%d, ", m.ExpiredCount))
b.WriteString(fmt.Sprintf("LeaseErrorCount:%d, ", m.ExpiredCount))
b.WriteString(fmt.Sprintf("ExpiredMaxLifeCount:%d, ", m.ExpiredMaxLifeCount))
b.WriteString(fmt.Sprintf("LeaseErrorCount:%d, ", m.LeaseErrorCount))
b.WriteString(fmt.Sprintf("MinFee:%d, ", m.MinFee))
b.WriteString(fmt.Sprintf("MaxFee:%d, ", m.MaxFee))
b.WriteString(fmt.Sprintf("AverageFee:%d, ", m.AverageFee))
Expand Down

0 comments on commit c17d3f4

Please sign in to comment.