From a3008369970f46aec7a8598b14a0a1d937305fb3 Mon Sep 17 00:00:00 2001 From: buddh0 Date: Thu, 18 Jul 2024 11:19:19 +0800 Subject: [PATCH] consensus/parlia: defaultEpochLength to p.config.Epoch --- consensus/parlia/parlia.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/consensus/parlia/parlia.go b/consensus/parlia/parlia.go index cc88adf369..24f35b6a8d 100644 --- a/consensus/parlia/parlia.go +++ b/consensus/parlia/parlia.go @@ -716,8 +716,8 @@ func (p *Parlia) snapshot(chain consensus.ChainHeaderReader, number uint64, hash // If we're at the genesis, snapshot the initial state. Alternatively if we have // piled up more headers than allowed to be reorged (chain reinit from a freezer), // consider the checkpoint trusted and snapshot it. - // even BEP-341 enabled, an offset `defaultEpochLength/2` can ensure getting the right validators. - if number == 0 || (number%p.config.Epoch == defaultEpochLength/2 && (len(headers) > int(params.FullImmutabilityThreshold))) { + // even BEP-341 enabled, an offset `p.config.Epoch/2` can ensure getting the right validators. + if number == 0 || (number%p.config.Epoch == p.config.Epoch/2 && (len(headers) > int(params.FullImmutabilityThreshold))) { var ( checkpoint *types.Header blockHash common.Hash @@ -728,7 +728,7 @@ func (p *Parlia) snapshot(chain consensus.ChainHeaderReader, number uint64, hash blockHash = checkpoint.Hash() } } else { - checkpoint = chain.GetHeaderByNumber(number - defaultEpochLength/2) + checkpoint = chain.GetHeaderByNumber(number - p.config.Epoch/2) blockHeader := chain.GetHeaderByNumber(number) if blockHeader != nil { blockHash = blockHeader.Hash()