Skip to content

Commit

Permalink
Fix 0 tps on startup bug
Browse files Browse the repository at this point in the history
  • Loading branch information
robschleusner committed Nov 7, 2023
1 parent 5891586 commit 79a8fbf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions quaistats/quaistats.go
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ func (s *Service) calculateTPS(block *types.Block) *tps {
fullBackend := s.backend.(fullNodeBackend)

for i := 0; i < int(batchesNeeded); i++ {
if currentBlock == nil {
if currentBlock == nil || currentBlock.NumberU64() == 0 {
log.Error("Encountered a nil block, stopping iteration")
break
}
Expand Down Expand Up @@ -1064,7 +1064,7 @@ func (s *Service) calculateTPS(block *types.Block) *tps {
// Add the number of transactions in the current block to the total
txCount += uint64(len(currentBlock.Transactions()))

if withinMinute && startBlockTime-currentBlock.Time() < 60 {
if withinMinute && startBlockTime < currentBlock.Time()+60 {
totalTransactions1m += uint64(len(currentBlock.Transactions()))
} else {
withinMinute = false
Expand Down

0 comments on commit 79a8fbf

Please sign in to comment.