From 0e0d74cab626e3081bf2b1b7ca376db39127eb22 Mon Sep 17 00:00:00 2001 From: Ethan Zhang Date: Sun, 20 Oct 2024 18:56:04 -0500 Subject: [PATCH] to avoid waiting 50 seconds after the transmission is complete --- lib/cmd/run/ethlistener.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/cmd/run/ethlistener.go b/lib/cmd/run/ethlistener.go index 29782c7..2ea0d63 100644 --- a/lib/cmd/run/ethlistener.go +++ b/lib/cmd/run/ethlistener.go @@ -148,7 +148,20 @@ func (el *EthereumListener) handleBlockResponse(response map[string]interface{}) // exit if total tx count is less than 100 fmt.Println("Best TPS:", el.bestTPS, "GasUsed%:", el.gasUsedAtBestTPS*100) el.Close() + return } + + // to avoid waiting 50 seconds after the transmission is complete + if len(el.blockStat) >= 3 { + for i := 1; i <=3; i ++ { + if el.blockStat[len(el.blockStat)-i].TxCount != 0 { + return + } + } + fmt.Println("Best TPS:", el.bestTPS, "GasUsed%:", el.gasUsedAtBestTPS) + el.Close() + } + } } }