Skip to content

Commit

Permalink
slice instead of pointer to slice
Browse files Browse the repository at this point in the history
  • Loading branch information
ciripel committed Jun 21, 2024
1 parent ab98eb5 commit 0fb27cd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Engine struct {
store *store.Store
state *state
notificator *notifications.DiscordNotificator
delegates *[]tezos.Address
delegates []tezos.Address
logger *slog.Logger
}

Expand Down Expand Up @@ -71,7 +71,7 @@ func NewEngine(ctx context.Context, config *configuration.Runtime, options *Engi
store: store,
state: newState(),
notificator: notificator,
delegates: &config.Delegates,
delegates: config.Delegates,
logger: slog.Default(), // TODO: replace with custom logger
}

Expand Down Expand Up @@ -154,12 +154,12 @@ func (e *Engine) getDelegates(ctx context.Context, cycle int64) ([]tezos.Address
return nil, err
}

if e.delegates == nil || len(*e.delegates) == 0 {
if len(e.delegates) == 0 {
return delegates, nil
}

delegates = lo.Filter[tezos.Address](delegates, func(d tezos.Address, _ int) bool {
return slices.Contains[[]tezos.Address, tezos.Address](*e.delegates, d)
return slices.Contains[[]tezos.Address, tezos.Address](e.delegates, d)
})

return delegates, nil
Expand Down

0 comments on commit 0fb27cd

Please sign in to comment.