Skip to content

Commit 898057a

Browse files
jsvisarjl493456442
authored andcommitted
Revert "expose stats"
This reverts commit d0cef76.
1 parent d74dd39 commit 898057a

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

core/state/state_sizer.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ type SizeTracker struct {
235235
abort chan struct{}
236236
aborted chan struct{}
237237
updateCh chan *stateUpdate
238-
stats map[common.Hash]SizeStats // internal stats map
239238
}
240239

241240
// NewSizeTracker creates a new state size tracker and starts it automatically
@@ -249,7 +248,6 @@ func NewSizeTracker(db ethdb.KeyValueStore, triedb *triedb.Database) (*SizeTrack
249248
abort: make(chan struct{}),
250249
aborted: make(chan struct{}),
251250
updateCh: make(chan *stateUpdate),
252-
stats: make(map[common.Hash]SizeStats),
253251
}
254252
go t.run()
255253
return t, nil
@@ -288,14 +286,13 @@ func (t *SizeTracker) run() {
288286
if err != nil {
289287
return
290288
}
291-
t.stats = stats
292289
h := sizeStatsHeap(slices.Collect(maps.Values(stats)))
293290
heap.Init(&h)
294291

295292
for {
296293
select {
297294
case u := <-t.updateCh:
298-
base, found := t.stats[u.originRoot]
295+
base, found := stats[u.originRoot]
299296
if !found {
300297
continue
301298
}
@@ -304,14 +301,15 @@ func (t *SizeTracker) run() {
304301
continue
305302
}
306303
stat := base.add(diff)
307-
t.stats[u.root] = stat
304+
stats[u.root] = stat
308305
t.upload(stat)
309306

310-
heap.Push(&h, t.stats[u.root])
311-
for len(h) > 0 && u.blockNumber-h[0].BlockNumber > statEvictThreshold {
312-
delete(t.stats, h[0].StateRoot)
307+
heap.Push(&h, stats[u.root])
308+
for u.blockNumber-h[0].BlockNumber > statEvictThreshold {
309+
delete(stats, h[0].StateRoot)
313310
heap.Pop(&h)
314311
}
312+
315313
case <-t.abort:
316314
return
317315
}
@@ -514,8 +512,6 @@ func (t *SizeTracker) Notify(update *stateUpdate) {
514512
case t.updateCh <- update:
515513
case <-t.abort:
516514
return
517-
default:
518-
// Drop update if channel is full
519515
}
520516
}
521517

0 commit comments

Comments
 (0)