fix stages forward order for staged stream sync

pull/4465/head
“GheisMohammadi” 1 year ago
parent 6f9a1ecda1
commit 12235f5c5c
No known key found for this signature in database
GPG Key ID: 15073AED3829FE90
  1. 3
      api/service/stagedstreamsync/staged_stream_sync.go
  2. 18
      api/service/stagedstreamsync/syncing.go

@ -267,9 +267,6 @@ func New(
logger zerolog.Logger,
) *StagedStreamSync {
// init stages order based on sync mode
initStagesOrder(config.SyncMode)
forwardStages := make([]*Stage, len(stagesList))
for i, stageIndex := range StagesForwardOrder {
for _, s := range stagesList {

@ -91,10 +91,13 @@ func CreateStagedSync(ctx context.Context,
stageStatesCfg := NewStageStatesCfg(bc, mainDB, dbs, config.Concurrency, blockExecution, logger, config.LogProgress)
stageStateSyncCfg := NewStageStateSyncCfg(bc, mainDB, config.Concurrency, protocol, logger, config.LogProgress)
stageReceiptsCfg := NewStageReceiptsCfg(bc, mainDB, dbs, config.Concurrency, protocol, isBeaconNode, config.LogProgress)
lastMileCfg := NewStageLastMileCfg(ctx, bc, mainDB)
lastMileCfg := NewStageLastMileCfg(ctx, bc, mainDB)
stageFinishCfg := NewStageFinishCfg(mainDB)
stages := DefaultStages(ctx,
// init stages order based on sync mode
initStagesOrder(config.SyncMode)
defaultStages := DefaultStages(ctx,
stageHeadsCfg,
stageSyncEpochCfg,
stageShortRangeCfg,
@ -115,6 +118,17 @@ func CreateStagedSync(ctx context.Context,
Int("minStreams", config.MinStreams).
Msg(WrapStagedSyncMsg("staged sync created successfully"))
var stages []*Stage
// if any of the default stages doesn't exist in forward order, delete it from the list of stages
for _, stg := range defaultStages {
for _, stageID := range StagesForwardOrder {
if stg.ID == stageID {
stages = append(stages, stg)
break
}
}
}
return New(
bc,
consensus,

Loading…
Cancel
Save