The default port of 8545 should be used even if the --fork option is used to connect to a remote URL with a port of 8545.
If the --port option is explicitly set, an error should be raised if the port cannot be used.
Current Behavior
When using the --fork option with a remote URL with a port of 8545, ganache runs on port 8546, even if --port 8545 is specified explicitly.
Steps to Reproduce
This command reproduces the problem:
yarn run ganache-cli --fork http://example.com:8545 --port 8545
This command does not:
yarn run ganache-cli --fork http://example.com:8546 --port 8545
Context
It appears that ganache is treating the remote port as unavailable locally, and silently using a different default port, even if that default port is specified explicitly. The only indication that a different port is being used is the output "Listening on 127.0.0.1:8546", which is easy to ignore since it is not an error message.
Your Environment
Version used: 6.9.1
NodeJS Version: 12.18.0
Operating System and version (include distro if Linux): Ubuntu 20.04
Expected Behavior
The default port of 8545 should be used even if the
--fork
option is used to connect to a remote URL with a port of 8545.If the
--port
option is explicitly set, an error should be raised if the port cannot be used.Current Behavior
When using the
--fork
option with a remote URL with a port of 8545, ganache runs on port 8546, even if--port 8545
is specified explicitly.Steps to Reproduce
This command reproduces the problem:
This command does not:
Context
It appears that ganache is treating the remote port as unavailable locally, and silently using a different default port, even if that default port is specified explicitly. The only indication that a different port is being used is the output "Listening on 127.0.0.1:8546", which is easy to ignore since it is not an error message.
Your Environment