From d99f3fefd12edbcdacd5d308580399e9df8a13b6 Mon Sep 17 00:00:00 2001 From: Emmanuel T Odeke Date: Tue, 7 Dec 2021 15:04:41 -0800 Subject: [PATCH] app: fix typo in calculation of failed transactions in TPS value (#149) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Noticed while I was auditing through evmosd code that inside the code that records TPS, that we have a typo in the calculation of nFailed, that instead used latestNSuccessful, of which if enough time is spent and the successful transactions have grown, while the number of failed transactions stays still, this can cause wrong TPS values to be reported. Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> (cherry picked from commit 7603acd27e7855118d65c74040440475960cc046) --- app/tps_counter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/tps_counter.go b/app/tps_counter.go index 82324b4b6d..410fee5045 100644 --- a/app/tps_counter.go +++ b/app/tps_counter.go @@ -76,7 +76,7 @@ func (tpc *tpsCounter) start(ctx context.Context) error { } else { panic(err) } - nFailed, err := tpc.recordValue(ctx, latestNSuccessful, lastNFailed, statusFailure) + nFailed, err := tpc.recordValue(ctx, latestNFailed, lastNFailed, statusFailure) if err == nil { nTxn += nFailed } else {