[cli_wallet] server-rpc-endpoint option behaves as optional with no default_value specified
server-rpc-endpoint
is the cli_wallet option that specifies the websocket enpoint url. In the code, it has the implicit value: ws://127.0.0.1:8090
, which means that if user does not pass the option explicitly, cli_wallet should not be able to connect to the endpoint since its url has an unspecified value.
Expected Behavior
Example output from the cli_wallet if there is no previous wallet configuration file: (unless working in offline mode)
(same as current cli_wallet output, but default value for the server-rpc-endpoint
option is visible for the user)
or
Please specify at least one endpoint url
or
Error: missing required option `server-rpc-endpoint`
(if declared as a required option)
Current Behavior
Logging RPC to file: logs/rpc/rpc.log
Starting a new wallet
main.cpp:170 main ] wdata.ws_server: ws://localhost:8090
Possible Solution(s)
- Remove the default value from
wallet_data::ws_server
and adddefault_value
to theserver-rpc-endpoint
- Remove the default value from
wallet_data::ws_server
and unless already specified in the configuration require at least one endpoint url from the user passed as an option to the program - Declare this option as required (which makes no sense if we want to load websocket endpoint from the wallet file)
Steps to Reproduce
- Run
cli_wallet
within an empty directory (no previous configuration loaded) - Wait for cli_wallet to try to connect to the default endpoint
ws://localhost:8090
even though user has not specified any options.
Context (Environment)
Bug encountered while working on the offline mode for cli_wallet
Built on Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-154-generic x86_64)
CMake options: -DCMAKE_BUILD_TYPE=Release -DBUILD_HIVE_TESTNET=OFF -DENABLE_SMT_SUPPORT=ON -DHIVE_STATIC_BUILD=ON
I think changing the code to match the first possible solution might be useful in this new offline mode as it doesn't change the old behavior too much, but everything is clearer to the user, but please review @bwrona @gandalf