Skip to content

Remove common.Config functions #2328

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

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 0 additions & 9 deletions snow/engine/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ type Config struct {
SharedCfg *SharedConfig
}

func (c *Config) Context() *snow.ConsensusContext {
return c.Ctx
}

// IsBootstrapped returns true iff this chain is done bootstrapping
func (c *Config) IsBootstrapped() bool {
return c.Ctx.State.Get().State == snow.NormalOp
}

// Shared among common.bootstrapper and snowman/avalanche bootstrapper
type SharedConfig struct {
// Tracks the last requestID that was used in a request
Expand Down
6 changes: 5 additions & 1 deletion snow/engine/snowman/bootstrap/bootstrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ func New(config Config, onFinished func(ctx context.Context, lastReqID uint32) e
return b, nil
}

func (b *bootstrapper) Context() *snow.ConsensusContext {
return b.Ctx
}

func (b *bootstrapper) Start(ctx context.Context, startReqID uint32) error {
b.Ctx.Log.Info("starting bootstrapper")

Expand Down Expand Up @@ -556,7 +560,7 @@ func (b *bootstrapper) checkFinish(ctx context.Context) error {
return nil
}

if b.IsBootstrapped() || b.awaitingTimeout {
if b.Ctx.State.Get().State == snow.NormalOp || b.awaitingTimeout {
return nil
}

Expand Down
4 changes: 4 additions & 0 deletions snow/engine/snowman/syncer/state_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ func New(
}
}

func (ss *stateSyncer) Context() *snow.ConsensusContext {
return ss.Ctx
}

func (ss *stateSyncer) StateSummaryFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, summaryBytes []byte) error {
// ignores any late responses
if requestID != ss.requestID {
Expand Down