-
Notifications
You must be signed in to change notification settings - Fork 673
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
refactor: simplify 02-client router funcs #6837
Conversation
} | ||
|
||
// GetRoute returns the LightClientModule registered for the provided client type or false otherwise. | ||
func (rtr *Router) GetRoute(clientType string) (exported.LightClientModule, bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any benefit in keeping this around? Can only see it meaningfully being used in Route
? Should be able to inline logic there from looks of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The routes
map is unexported so this is just a dumb accessor. But indeed, it's only really being used from Route
, but I don't think its a big deal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Nice refactor!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
green < red = good refactor
Description
The goal of the PR is to reduce the amount of string parsing and duplicate code. Mostly usage of
ParseClientIdentifier
when accessing the 02-client light client module router.func Route() (LightClientModule, error)
methodGetRoute
on the 02-clientRouter
to acceptclientType
only (aligns with has/add funcs)MustParseClientIdentifier
for usage in 02-client handlersref: #6760 (comment)
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
).godoc
comments.Files changed
in the GitHub PR explorer.SonarCloud Report
in the comment section below once CI passes.