Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release sync mode type. no functional changes. #12794

Merged
merged 7 commits into from
Nov 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
save
  • Loading branch information
AskAlexSharov committed Nov 20, 2024
commit 89b05724dbb27b02fa8b9f2c3c62df81b89271ff
26 changes: 26 additions & 0 deletions eth/stagedsync/stages/sync_mode.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package stages

import (
"context"
)

type Mode int8 // in which staged sync can run

const (
ModeBlockProduction Mode = iota
ModeForkValidation
ModeApplyingBlocks
)

type modeContextKey struct{}

func PutMode(ctx context.Context, v Mode) context.Context {
return context.WithValue(ctx, modeContextKey{}, v)
}
func GetMode(ctx context.Context) (Mode, bool) {
v := ctx.Value(modeContextKey{})
if v == nil {
return 0, false
}
return v.(Mode), true
}