From 6891288787df7e4d342fef82d7c7581458f6b6b8 Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi <1591639+s1na@users.noreply.github.com> Date: Wed, 7 Dec 2022 17:36:54 +0100 Subject: [PATCH] core: fix state flushing for catalyst mode (#26319) The gcproc field tracks the amount of time spent processing blocks, and is used to trigger a state flush to disk when a certain threshold is reached. After the merge, single block insertion by CL is the most common source of block processing time, but this time was not added into gcproc. --- core/blockchain.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/blockchain.go b/core/blockchain.go index 992e5a0f6..f9b92192c 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1764,6 +1764,10 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals, setHead bool) stats.report(chain, it.index, dirty, setHead) if !setHead { + // After merge we expect few side chains. Simply count + // all blocks the CL gives us for GC processing time + bc.gcproc += proctime + return it.index, nil // Direct block insertion of a single block } switch status {