Skip to content

Commit

Permalink
fixed logic bug around tps computation
Browse files Browse the repository at this point in the history
  • Loading branch information
hubchub committed May 3, 2023
1 parent 2360c0a commit 508ca19
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions quaistats/quaistats.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,9 @@ func (s *Service) computeTps(block *types.Block) (uint64, error) {

var blockTps uint64
if parentTps == c_uintMaxValue {
blockTps = ((c_alpha-1)*parentTps + instantTps) / c_alpha
} else {
blockTps = instantTps
} else {
blockTps = ((c_alpha-1)*parentTps + instantTps) / c_alpha
}

s.tpsLookupCache.Add(block.Hash(), blockCacheDto{
Expand Down Expand Up @@ -706,7 +706,7 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
ChainID: s.chainID.Uint64(),
}

if tps, err := s.computeTps(block); err != nil {
if tps, err := s.computeTps(block); err == nil {
ret.Tps = tps
} else {
log.Error("error computing tps", "error", err.Error())
Expand Down

0 comments on commit 508ca19

Please sign in to comment.