fix(core): always set p2p port in non-dev mode (#1919)
* if geth is in non-dev mode, it has been explicitly set by either disabling discovery or setting a p2p port. To prevent geth from crashing if another process is using the default p2p port, always set the p2p port if geth is in non-dev mode.
This commit is contained in:
parent
c4e09f261e
commit
5af2800f15
|
@ -339,9 +339,9 @@ impl Geth {
|
|||
}
|
||||
}
|
||||
GethMode::NonDev(PrivateNetOptions { p2p_port, discovery }) => {
|
||||
if let Some(p2p_port) = p2p_port {
|
||||
cmd.arg("--port").arg(p2p_port.to_string());
|
||||
}
|
||||
// automatically enable and set the p2p port if we are in non-dev mode
|
||||
let port = if let Some(port) = p2p_port { port } else { unused_port() };
|
||||
cmd.arg("--port").arg(port.to_string());
|
||||
|
||||
// disable discovery if the flag is set
|
||||
if !discovery {
|
||||
|
|
Loading…
Reference in New Issue