-
Notifications
You must be signed in to change notification settings - Fork 787
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Network selector #1729
Network selector #1729
Conversation
Does the data path change to /NanoBeta by default if a live net node is compiled and only --network beta is given? What are the consequences if an already complete beta database is provided by accident to a live net node? |
@guilhermelawless If you pick the wrong database, an error is logged and the node exits (that's already the case). The data path should probably change to defaults if you don't supply a path; I'll change it so that the network is checked before data_path. Thanks. |
89b8739
to
ea5e10f
Compare
3e33371
to
0503787
Compare
9855632
to
bdba1da
Compare
…gration). Also remove bool assignment from error.
bdba1da
to
8c88616
Compare
Closes #1099
A new CLI option is added:
--network live|beta|test
Example of using a livenet-compiled wallet to run on betanet:
./nano_wallet --network beta --data_path MyBetaDirectory
This is a CLI option instead of a config option because the config-file may not exist yet.
The ACTIVE_NETWORK build flag is still there to define the default value if no network option is present. As a result, RC builds for beta don't require a network option, so startup scripts, etc should work as before.
As discussed in #1099, some other projects use flags such as -testnet, but those mean sightly different things. A --network flag makes it clear that we don't follow any other projects' network naming standard and it mirrors how we choose network at compile-time (this doesn't seem like an option regular users will employ)
Implementation details:
nano::network_params
member where the per-network values can be queried.work_generate_blocking (nano::uint256_union const &, uint64_t = nano::work_pool::publish_threshold);
nano::genesis_amount
used to depend on the compile-time network value. These are now only available for tests, which enforces the testnet. Since only tests include testutil.hpp, any attempts to use these in the node results in a compile error. As a result, this PR contains almost no changes to tests (initially there was a network_params insystem
, etc, but that meant a huge amount of changes with no gain)Tests pass and it appears to sync fine on both networks.