-
Notifications
You must be signed in to change notification settings - Fork 43
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
Wrapped MultiNode client #1006
Wrapped MultiNode client #1006
Conversation
pkg/solana/chain.go
Outdated
@@ -291,6 +293,9 @@ func newChain(id string, cfg *config.TOMLConfig, ks core.Keystore, lggr logger.L | |||
|
|||
ch.multiNode = multiNode | |||
ch.txSender = txSender | |||
ch.multiClient = client.NewMultiClient(func() (client.ReaderWriter, error) { | |||
return ch.multiNode.SelectRPC() | |||
}) |
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.
Isn't this redundant with the prior initialization?
ch.multiClient = client.NewMultiClient(ch.getClient)
Either way, if the multinode is enabled the same SelectRPC()
function will be called, right?
// getClient returns a client, randomly selecting one from available and valid nodes
// If multinode is enabled, it will return a client using the multinode selection instead.
func (c *chain) getClient() (client.ReaderWriter, error) {
if c.cfg.MultiNode.Enabled() {
return c.multiNode.SelectRPC()
}
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.
Actually I just re-read @DylanTinianov's comment on my PR and saw he's proposing to get rid of the MultiNode path from c.getClient
. If we do that, then I think this makes sense as-is.
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.
We could either do that in this PR, or in my PR
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.
Removed second initialization of multiClient.
We can't remove the MultiNode path from c.getClient
as it's by other methods of the chain
struct.
10eec3e
Quality Gate failedFailed conditions |
Wrapped over MultiNode and lazy-loaded client to ensure components like LogPoller can interact with them without need to handle error returned on RPC selection.
See comment.