From 498458b4102c0d32d7453035a115e6b9df5e485d Mon Sep 17 00:00:00 2001
From: Martin Holst Swende <martin@swende.se>
Date: Fri, 26 Feb 2021 16:33:37 +0100
Subject: [PATCH] core/state: fix eta calculation on pruning (#22386)

---
 core/state/pruner/pruner.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/state/pruner/pruner.go b/core/state/pruner/pruner.go
index 1fbfa55b6..530a34854 100644
--- a/core/state/pruner/pruner.go
+++ b/core/state/pruner/pruner.go
@@ -155,7 +155,7 @@ func prune(maindb ethdb.Database, stateBloom *stateBloom, middleStateRoots map[c
 			if done := binary.BigEndian.Uint64(key[:8]); done > 0 {
 				var (
 					left  = math.MaxUint64 - binary.BigEndian.Uint64(key[:8])
-					speed = done/uint64(time.Since(start)/time.Millisecond+1) + 1 // +1s to avoid division by zero
+					speed = done/uint64(time.Since(pstart)/time.Millisecond+1) + 1 // +1s to avoid division by zero
 				)
 				eta = time.Duration(left/speed) * time.Millisecond
 			}
-- 
GitLab