Skip to content

Commit

Permalink
Remove common.Config functions (#2328)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored Nov 17, 2023
1 parent 585424e commit fe72c5b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
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

0 comments on commit fe72c5b

Please sign in to comment.