Improve SONs config parameter checks

This commit is contained in:
serkixenos 2022-07-29 18:07:49 +02:00
parent e9dbafb56a
commit 7629ecc8b3

View file

@ -161,7 +161,7 @@ void peerplays_sidechain_plugin_impl::plugin_set_program_options(
cli.add_options()("ethereum-node-rpc-url", bpo::value<string>()->default_value("127.0.0.1:8545"), "Ethereum node RPC URL [http[s]://]host[:port]");
cli.add_options()("ethereum-node-rpc-user", bpo::value<string>(), "Ethereum RPC user");
cli.add_options()("ethereum-node-rpc-password", bpo::value<string>(), "Ethereum RPC password");
cli.add_options()("ethereum-wallet-contract-address", bpo::value<string>()->default_value("0000000000000000000000000000000000000000"), "Ethereum wallet contract address");
cli.add_options()("ethereum-wallet-contract-address", bpo::value<string>(), "Ethereum wallet contract address");
cli.add_options()("ethereum-private-key", bpo::value<vector<string>>()->composing()->multitoken()->DEFAULT_VALUE_VECTOR(std::make_pair("5fbbb31be52608d2f52247e8400b7fcaa9e0bc12", "9bedac2bd8fe2a6f6528e066c67fc8ac0622e96828d40c0e820d83c5bd2b0589")),
"Tuple of [Ethereum public key, Ethereum private key] (may specify multiple times)");
@ -169,7 +169,7 @@ void peerplays_sidechain_plugin_impl::plugin_set_program_options(
cli.add_options()("hive-node-rpc-url", bpo::value<string>()->default_value("127.0.0.1:28090"), "Hive node RPC URL [http[s]://]host[:port]");
cli.add_options()("hive-node-rpc-user", bpo::value<string>(), "Hive node RPC user");
cli.add_options()("hive-node-rpc-password", bpo::value<string>(), "Hive node RPC password");
cli.add_options()("hive-wallet-account-name", bpo::value<string>()->default_value("son-account"), "Hive wallet account name"),
cli.add_options()("hive-wallet-account-name", bpo::value<string>(), "Hive wallet account name"),
cli.add_options()("hive-private-key", bpo::value<vector<string>>()->composing()->multitoken()->DEFAULT_VALUE_VECTOR(std::make_pair("TST6LLegbAgLAy28EHrffBVuANFWcFgmqRMW13wBmTExqFE9SCkg4", "5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n")),
"Tuple of [Hive public key, Hive private key] (may specify multiple times)");
@ -220,25 +220,27 @@ void peerplays_sidechain_plugin_impl::plugin_initialize(const boost::program_opt
config_ready_bitcoin = options.count("bitcoin-node-ip") &&
options.count("bitcoin-node-zmq-port") && options.count("bitcoin-node-rpc-port") &&
options.count("bitcoin-node-rpc-user") && options.count("bitcoin-node-rpc-password") &&
/*options.count("bitcoin-wallet") && options.count("bitcoin-wallet-password") &&*/
options.count("bitcoin-wallet-name") && options.count("bitcoin-wallet-password") &&
options.count("bitcoin-private-key");
if (!config_ready_bitcoin) {
if (sidechain_enabled_bitcoin && !config_ready_bitcoin) {
wlog("Haven't set up Bitcoin sidechain parameters");
}
sidechain_enabled_ethereum = options.at("ethereum-sidechain-enabled").as<bool>();
config_ready_ethereum = options.count("ethereum-node-rpc-url") &&
/*options.count("ethereum-node-rpc-user") && options.count("ethereum-node-rpc-password") &&*/
options.count("ethereum-wallet-contract-address") &&
options.count("ethereum-private-key");
if (!config_ready_ethereum) {
if (sidechain_enabled_ethereum && !config_ready_ethereum) {
wlog("Haven't set up Ethereum sidechain parameters");
}
sidechain_enabled_hive = options.at("hive-sidechain-enabled").as<bool>();
config_ready_hive = options.count("hive-node-rpc-url") &&
/*options.count("hive-node-rpc-user") && options.count("hive-node-rpc-password") &&*/
options.count("hive-wallet-account-name") &&
options.count("hive-private-key");
if (!config_ready_hive) {
if (sidechain_enabled_hive && !config_ready_hive) {
wlog("Haven't set up Hive sidechain parameters");
}