From 09b9dfc3cec8252373ead87d1af99452aab4c06b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 27 Nov 2020 15:55:59 +0100 Subject: [PATCH] Print gas limit sum in mpool stat --- cli/mpool.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cli/mpool.go b/cli/mpool.go index 4979f6ddc..87e928e08 100644 --- a/cli/mpool.go +++ b/cli/mpool.go @@ -233,6 +233,7 @@ var mpoolStat = &cli.Command{ addr string past, cur, future uint64 belowCurr, belowPast uint64 + gasLimit big.Int } buckets := map[address.Address]*statBucket{} @@ -274,6 +275,7 @@ var mpoolStat = &cli.Command{ var s mpStat s.addr = a.String() + s.gasLimit = big.Zero() for _, m := range bkt.msgs { if m.Message.Nonce < act.Nonce { @@ -290,6 +292,8 @@ var mpoolStat = &cli.Command{ if m.Message.GasFeeCap.LessThan(minBF) { s.belowPast++ } + + s.gasLimit = big.Add(s.gasLimit, types.NewInt(uint64(m.Message.GasLimit))) } out = append(out, s) @@ -300,6 +304,7 @@ var mpoolStat = &cli.Command{ }) var total mpStat + total.gasLimit = big.Zero() for _, stat := range out { total.past += stat.past @@ -307,12 +312,13 @@ var mpoolStat = &cli.Command{ total.future += stat.future total.belowCurr += stat.belowCurr total.belowPast += stat.belowPast + total.gasLimit = big.Add(total.gasLimit, stat.gasLimit) - fmt.Printf("%s: Nonce past: %d, cur: %d, future: %d; FeeCap cur: %d, min-%d: %d \n", stat.addr, stat.past, stat.cur, stat.future, stat.belowCurr, cctx.Int("basefee-lookback"), stat.belowPast) + fmt.Printf("%s: Nonce past: %d, cur: %d, future: %d; FeeCap cur: %d, min-%d: %d, gasLimit: %s\n", stat.addr, stat.past, stat.cur, stat.future, stat.belowCurr, cctx.Int("basefee-lookback"), stat.belowPast, stat.gasLimit) } fmt.Println("-----") - fmt.Printf("total: Nonce past: %d, cur: %d, future: %d; FeeCap cur: %d, min-%d: %d \n", total.past, total.cur, total.future, total.belowCurr, cctx.Int("basefee-lookback"), total.belowPast) + fmt.Printf("total: Nonce past: %d, cur: %d, future: %d; FeeCap cur: %d, min-%d: %d, gasLimit: %s\n", total.past, total.cur, total.future, total.belowCurr, cctx.Int("basefee-lookback"), total.belowPast, total.gasLimit) return nil },