Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
iansuvak committed Nov 16, 2022
1 parent d2e08bc commit b6b079f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions data/pools/transactionPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,6 @@ 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 @@ -738,14 +737,15 @@ func (pool *TransactionPool) recomputeBlockEvaluator(committedTxIds map[transact
for _, tx := range txgroup {
pool.statusCache.put(tx, err.Error())
}

switch err := err.(type) {
// metrics here are duplicated for historic reasons. stats is hardly used and should be removed in favor of asmstats
switch terr := err.(type) {
case *ledgercore.TransactionInLedgerError:
asmStats.CommittedCount++
stats.RemovedInvalidCount++
case transactions.TxnDeadError:
if proto.MaxTxnLife == uint64(err.LastValid-err.FirstValid) {
asmStats.ExpiredMaxLifeCount++
if int(terr.LastValid-terr.FirstValid) > 20 {
// cutoff value here is picked as a somewhat arbitrary cutoff trying to separate longer lived transactions from very short lived ones
asmStats.ExpiredLongLivedCount++
}
asmStats.ExpiredCount++
stats.ExpiredCount++
Expand Down
4 changes: 2 additions & 2 deletions logging/telemetryspec/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +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
ExpiredLongLivedCount int // number of expired transactions with non-super short LastValid values
LeaseErrorCount int // number of transactions removed because it has an already used lease
MinFee uint64
MaxFee uint64
Expand Down Expand Up @@ -106,7 +106,7 @@ 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("ExpiredMaxLifeCount:%d, ", m.ExpiredMaxLifeCount))
b.WriteString(fmt.Sprintf("ExpiredLongLivedCount:%d, ", m.ExpiredLongLivedCount))
b.WriteString(fmt.Sprintf("LeaseErrorCount:%d, ", m.LeaseErrorCount))
b.WriteString(fmt.Sprintf("MinFee:%d, ", m.MinFee))
b.WriteString(fmt.Sprintf("MaxFee:%d, ", m.MaxFee))
Expand Down

0 comments on commit b6b079f

Please sign in to comment.