-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: add with_unused_ports method to rpc and network args #6109
Conversation
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.
pedantic style nit
bin/reth/src/args/network_args.rs
Outdated
pub fn with_unused_p2p_port(&mut self) { | ||
self.port = 0; | ||
} | ||
|
||
/// Sets the p2p and discovery ports to zero, allowing the OD to assign a random unused port | ||
/// when network components bind to sockets. | ||
pub fn with_unused_ports(&mut self) { |
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.
do we want &mut here or self?
we can have two functions if convenient, though the &mut self should also return &mut Self
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.
changed to mut self -> Self
ref #6107 (comment)
Adds methods on network, discovery, and rpc args for setting ports to zero. This means they will be set to an unused port when bound. This is useful in tests, when many nodes are being spun up at the same time.