improve stage handling for create new instance of staged stream sync

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

@ -266,7 +266,7 @@ func New(
logger zerolog.Logger,
) *StagedStreamSync {
forwardStages := make([]*Stage, len(stagesList))
forwardStages := make([]*Stage, len(StagesForwardOrder))
for i, stageIndex := range StagesForwardOrder {
for _, s := range stagesList {
if s.ID == stageIndex {
@ -276,7 +276,7 @@ func New(
}
}
revertStages := make([]*Stage, len(stagesList))
revertStages := make([]*Stage, len(StagesRevertOrder))
for i, stageIndex := range StagesRevertOrder {
for _, s := range stagesList {
if s.ID == stageIndex {
@ -286,7 +286,7 @@ func New(
}
}
pruneStages := make([]*Stage, len(stagesList))
pruneStages := make([]*Stage, len(StagesCleanUpOrder))
for i, stageIndex := range StagesCleanUpOrder {
for _, s := range stagesList {
if s.ID == stageIndex {

@ -118,22 +118,11 @@ 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,
mainDB,
stages,
defaultStages,
isBeaconNode,
protocol,
isBeaconNode,

Loading…
Cancel
Save