mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-15 17:15:37 +00:00
fix LC data import --only-new
regression (#5616)
Corrects LC server startup logic for `LightClientDataImportMode.OnlyNew` after regression in #5607.
This commit is contained in:
parent
7554ca2583
commit
b0b8f21223
@ -764,23 +764,22 @@ proc initLightClientDataCache*(dag: ChainDAGRef) =
|
|||||||
initDur = lightClientEndTick - lightClientStartTick, res
|
initDur = lightClientEndTick - lightClientStartTick, res
|
||||||
if res.isErr:
|
if res.isErr:
|
||||||
return
|
return
|
||||||
if dag.lcDataStore.importMode == LightClientDataImportMode.OnDemand:
|
|
||||||
return
|
|
||||||
|
|
||||||
# Import historic data
|
# Import historic data
|
||||||
dag.lcDataStore.cache.tailSlot = targetTailSlot
|
if dag.lcDataStore.importMode == LightClientDataImportMode.Full:
|
||||||
let targetTailPeriod = targetTailSlot.sync_committee_period
|
dag.lcDataStore.cache.tailSlot = targetTailSlot
|
||||||
if targetTailPeriod < finalizedPeriod:
|
let targetTailPeriod = targetTailSlot.sync_committee_period
|
||||||
# `countdown` through 0 fails on distinct `uint64`
|
if targetTailPeriod < finalizedPeriod:
|
||||||
# https://github.com/nim-lang/Nim/pull/19926
|
# `countdown` through 0 fails on distinct `uint64`
|
||||||
var period = finalizedPeriod - 1
|
# https://github.com/nim-lang/Nim/pull/19926
|
||||||
while period >= targetTailPeriod:
|
var period = finalizedPeriod - 1
|
||||||
if dag.initLightClientDataForPeriod(period).isErr:
|
while period >= targetTailPeriod:
|
||||||
res.err()
|
if dag.initLightClientDataForPeriod(period).isErr:
|
||||||
if period <= targetTailPeriod:
|
res.err()
|
||||||
break
|
if period <= targetTailPeriod:
|
||||||
dec period
|
break
|
||||||
debug "Historic LC data imported", res
|
dec period
|
||||||
|
debug "Historic LC data imported", res
|
||||||
|
|
||||||
proc processNewBlockForLightClient*(
|
proc processNewBlockForLightClient*(
|
||||||
dag: ChainDAGRef,
|
dag: ChainDAGRef,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user