diff --git a/quaistats/quaistats.go b/quaistats/quaistats.go index 6b03de6ae8..5b6e2c99e6 100644 --- a/quaistats/quaistats.go +++ b/quaistats/quaistats.go @@ -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 } @@ -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