confirmation_height_clear cli account param (#3836)
* confirmation_height_clear cli account param * Add back missing password option * Improve the error/help messages to the required account option - Improve the error message to say the account can be 'all' - Improve the confirmation_height_clear help message to inform the value 'all' can be passed to clear all accounts Co-authored-by: Thiago Silva <thiago@nano.org>
This commit is contained in:
parent
4d65b8c32a
commit
bee7044d3f
1 changed files with 13 additions and 9 deletions
|
@ -57,7 +57,7 @@ void nano::add_node_options (boost::program_options::options_description & descr
|
|||
("online_weight_clear", "Clear online weight history records")
|
||||
("peer_clear", "Clear online peers database dump")
|
||||
("unchecked_clear", "Clear unchecked blocks")
|
||||
("confirmation_height_clear", "Clear confirmation height")
|
||||
("confirmation_height_clear", "Clear confirmation height. Requires an <account> option that can be 'all' to clear all accounts")
|
||||
("final_vote_clear", "Clear final votes")
|
||||
("rebuild_database", "Rebuild LMDB database with vacuum for best compaction")
|
||||
("migrate_database_lmdb_to_rocksdb", "Migrates LMDB database to RocksDB")
|
||||
|
@ -321,7 +321,7 @@ std::error_code nano::handle_node_options (boost::program_options::variables_map
|
|||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "wallet_add command requires one <wallet> option and one <key> option and optionally one <password> option\n";
|
||||
std::cerr << "account_create command requires one <wallet> option and optionally one <password> option\n";
|
||||
ec = nano::error_cli::invalid_arguments;
|
||||
}
|
||||
}
|
||||
|
@ -579,10 +579,9 @@ std::error_code nano::handle_node_options (boost::program_options::variables_map
|
|||
nano::inactive_node node (data_path, node_flags);
|
||||
if (!node.node->init_error ())
|
||||
{
|
||||
auto account_it = vm.find ("account");
|
||||
if (account_it != vm.cend ())
|
||||
if (vm.count ("account") == 1)
|
||||
{
|
||||
auto account_str = account_it->second.as<std::string> ();
|
||||
auto account_str = vm["account"].as<std::string> ();
|
||||
nano::account account;
|
||||
if (!account.decode_account (account_str))
|
||||
{
|
||||
|
@ -609,17 +608,22 @@ std::error_code nano::handle_node_options (boost::program_options::variables_map
|
|||
ec = nano::error_cli::generic;
|
||||
}
|
||||
}
|
||||
else if (account_str == "all")
|
||||
{
|
||||
auto transaction (node.node->store.tx_begin_write ());
|
||||
reset_confirmation_heights (transaction, node.node->network_params.ledger, node.node->store);
|
||||
std::cout << "Confirmation heights of all accounts (except genesis which is set to 1) are set to 0" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Invalid account id\n";
|
||||
std::cerr << "Specify either valid account id or 'all'\n";
|
||||
ec = nano::error_cli::invalid_arguments;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto transaction (node.node->store.tx_begin_write ());
|
||||
reset_confirmation_heights (transaction, node.node->network_params.ledger, node.node->store);
|
||||
std::cout << "Confirmation heights of all accounts (except genesis which is set to 1) are set to 0" << std::endl;
|
||||
std::cerr << "confirmation_height_clear command requires one <account> option that may contain an account or the value 'all'\n";
|
||||
ec = nano::error_cli::invalid_arguments;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue