35 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY
36 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "daemon"
43 ,
const boost::optional<tools::login>& login
48 : m_executor(
ip,
port, login, ssl_options, is_rpc, rpc_server)
55 std::cout <<
"use: print_pl [white] [gray] [<limit>]" << std::endl;
62 for (
size_t i = 0; i < args.size(); ++i)
64 if (args[i] ==
"white")
68 else if (args[i] ==
"gray")
74 std::cout <<
"unexpected argument: " << args[i] << std::endl;
79 const bool print_both = !white && !gray;
80 return m_executor.
print_peer_list(white | print_both, gray | print_both, limit);
85 if (!args.empty())
return false;
92 if (!args.empty())
return false;
99 if (!args.empty())
return false;
106 if (!args.empty())
return false;
113 if (!args.empty())
return false;
120 if (!args.empty())
return false;
127 if (!args.empty())
return false;
134 if (!args.empty())
return false;
143 std::cout <<
"need block index parameter" << std::endl;
150 std::cout <<
"wrong starter block index parameter" << std::endl;
155 std::cout <<
"wrong end block index parameter" << std::endl;
166 std::cout <<
"use: set_log [<log_level_number_0-4> | <categories>]" << std::endl;
180 std::cout <<
"wrong number range, use: set_log <log_level_number_0-4>" << std::endl;
193 if (!args.empty())
return false;
200 bool include_hex =
false;
203 for (
unsigned int i = 1; i < args.size(); ++i) {
204 if (args[i] ==
"+hex")
208 std::cout <<
"unexpected argument: " << args[i] << std::endl;
214 std::cout <<
"expected: print_block (<block_hash> | <block_height>) [+hex]" << std::endl;
224 catch (
const boost::bad_lexical_cast&)
238 bool include_hex =
false;
239 bool include_json =
false;
242 for (
unsigned int i = 1; i < args.size(); ++i) {
243 if (args[i] ==
"+hex")
245 else if (args[i] ==
"+json")
249 std::cout <<
"unexpected argument: " << args[i] << std::endl;
255 std::cout <<
"expected: print_tx <transaction_hash> [+hex] [+json]" << std::endl;
273 std::cout <<
"expected: is_key_image_spent <key_image>" << std::endl;
291 if (!args.empty())
return false;
298 if (!args.empty())
return false;
305 if (!args.empty())
return false;
314 std::cout <<
"Please specify a wallet address to mine for: start_mining <addr> [<threads>|auto]" << std::endl;
328 [](
const std::string &url,
const std::vector<std::string> &addresses,
bool dnssec_valid){return addresses[0];});
335 std::cout <<
"target account address has wrong format" << std::endl;
359 if (
info.is_subaddress)
365 std::cout <<
"Mining to a " << (nettype ==
cryptonote::TESTNET ?
"testnet" :
"stagenet") <<
" address, make sure this is intentional!" << std::endl;
367 bool do_background_mining =
false;
368 bool ignore_battery =
false;
378 ignore_battery =
true;
390 do_background_mining =
true;
400 if (args[1] ==
"auto" || args[1] ==
"autodetect")
407 threads_count = (ok && 0 < threads_count) ? threads_count : 1;
411 m_executor.
start_mining(
info.address, threads_count, nettype, do_background_mining, ignore_battery);
418 if (!args.empty())
return false;
430 if (!args.empty())
return false;
437 if (!args.empty())
return false;
444 if(args.size()>1)
return false;
450 limit = std::stoll(args[0]);
452 catch(
const std::exception& ex) {
453 std::cout <<
"failed to parse argument" << std::endl;
457 return m_executor.
set_limit(limit, limit);
462 if(args.size()>1)
return false;
468 limit = std::stoll(args[0]);
470 catch(
const std::exception& ex) {
471 std::cout <<
"failed to parse argument" << std::endl;
480 if(args.size()>1)
return false;
486 limit = std::stoll(args[0]);
488 catch(
const std::exception& ex) {
489 std::cout <<
"failed to parse argument" << std::endl;
498 if (args.empty())
return false;
502 limit = std::stoi(args[0]);
505 catch(
const std::exception& ex) {
506 _erro(
"stoi exception");
515 if (args.empty())
return false;
519 limit = std::stoi(args[0]);
522 catch(
const std::exception& ex) {
523 _erro(
"stoi exception");
532 if (!args.empty())
return false;
538 if (!args.empty())
return false;
545 if (args.size() == 0) {
548 else if (args.size() == 1) {
552 catch(
const std::exception& ex) {
555 if (version <= 0 || version > 255)
566 if (!args.empty())
return false;
572 if (args.size() != 1 && args.size() != 2)
return false;
580 seconds = std::numeric_limits<time_t>::max();
583 seconds = std::stoi(args[1]);
586 catch (
const std::exception &e)
595 return m_executor.
ban(
ip, seconds);
600 if (args.size() != 1)
return false;
607 if (args.size() > 1)
return false;
610 if (args.size() == 1)
615 std::cout <<
"failed to parse tx id" << std::endl;
625 std::vector<uint64_t> amounts;
630 for (
size_t n = 0; n < args.size(); ++n)
632 if (args[n][0] ==
'@')
634 amounts.push_back(boost::lexical_cast<uint64_t>(args[n].c_str() + 1));
638 min_count = boost::lexical_cast<uint64_t>(args[n]);
643 max_count = boost::lexical_cast<uint64_t>(args[n]);
648 std::cout <<
"Invalid syntax: more than two non-amount parameters" << std::endl;
659 std::cout <<
"need block height parameter" << std::endl;
666 std::cout <<
"wrong starter block height parameter" << std::endl;
671 std::cout <<
"wrong count parameter" << std::endl;
682 std::cout <<
"usage: alt_chain_info [block_hash]" << std::endl;
686 return m_executor.
alt_chain_info(args.size() == 1 ? args[0] :
"");
693 std::cout <<
"Exactly one parameter is needed" << std::endl;
700 std::cout <<
"wrong number of blocks" << std::endl;
711 std::cout <<
"Exactly one parameter is needed: check, download, or update" << std::endl;
715 return m_executor.
update(args.front());
720 if (args.size() != 1)
return false;
726 std::cout <<
"failed to parse tx id" << std::endl;
735 if (args.size() != 0)
return false;
742 if (args.size() != 1)
744 std::cout <<
"Exactly one parameter is needed" << std::endl;
750 uint64_t nblocks = boost::lexical_cast<uint64_t>(args[0]);
753 std::cout <<
"number of blocks must be greater than 0" << std::endl;
758 catch (
const boost::bad_lexical_cast&)
760 std::cout <<
"number of blocks must be a number greater than 0" << std::endl;
773 if (args.size() > 1)
return false;
775 if (args.empty() || args[0] !=
"confirm")
777 std::cout <<
"Warning: pruning from within electroneumd will not shrink the database file size." << std::endl;
778 std::cout <<
"Instead, parts of the file will be marked as free, so the file will not grow" << std::endl;
779 std::cout <<
"until that newly free space is used up. If you want a smaller file size now," << std::endl;
780 std::cout <<
"exit electroneumd and run electroneum-blockchain-prune (you will temporarily need more" << std::endl;
781 std::cout <<
"disk space for the database conversion though). If you are OK with the database" << std::endl;
782 std::cout <<
"file keeping the same size, re-run this command with the \"confirm\" parameter." << std::endl;
796 if(args.size() != 1)
return false;
800 bool is_validator_key_valid = std::count_if(
key.begin(),
key.end(), [](
int c) {return !std::isxdigit(c);}) == 0;
801 if(!is_validator_key_valid ||
key.size() != 64) {
802 std::cout <<
"Failed to parse validator key (wrong format)." << std::endl;
811 if(args.size() != 0)
return false;
818 if(args.size() != 2)
return false;
bool show_bans(const std::vector< std::string > &args)
bool alt_chain_info(const std::vector< std::string > &args)
bool print_transaction_pool_long(const std::vector< std::string > &args)
bool version(const std::vector< std::string > &args)
bool print_peer_list(const std::vector< std::string > &args)
bool prune_blockchain(const std::vector< std::string > &args)
bool update(const std::vector< std::string > &args)
bool print_blockchain_info(const std::vector< std::string > &args)
bool generate_ed25519_keypair(const std::vector< std::string > &args)
bool set_validator_key(const std::vector< std::string > &args)
bool print_height(const std::vector< std::string > &args)
bool relay_tx(const std::vector< std::string > &args)
bool sync_info(const std::vector< std::string > &args)
bool print_peer_list_stats(const std::vector< std::string > &args)
t_command_parser_executor(uint32_t ip, uint16_t port, const boost::optional< tools::login > &login, const epee::net_utils::ssl_options_t &ssl_options, bool is_rpc, cryptonote::core_rpc_server *rpc_server=NULL)
bool stop_save_graph(const std::vector< std::string > &args)
bool set_limit_up(const std::vector< std::string > &args)
bool pop_blocks(const std::vector< std::string > &args)
bool ban(const std::vector< std::string > &args)
bool flush_txpool(const std::vector< std::string > &args)
bool out_peers(const std::vector< std::string > &args)
bool print_coinbase_tx_sum(const std::vector< std::string > &args)
bool check_blockchain_pruning(const std::vector< std::string > &args)
bool start_save_graph(const std::vector< std::string > &args)
bool show_difficulty(const std::vector< std::string > &args)
bool print_transaction_pool_short(const std::vector< std::string > &args)
bool output_histogram(const std::vector< std::string > &args)
bool print_transaction(const std::vector< std::string > &args)
bool is_key_image_spent(const std::vector< std::string > &args)
bool in_peers(const std::vector< std::string > &args)
bool hide_hash_rate(const std::vector< std::string > &args)
bool print_net_stats(const std::vector< std::string > &args)
bool print_blockchain_dynamic_stats(const std::vector< std::string > &args)
bool set_limit(const std::vector< std::string > &args)
bool mining_status(const std::vector< std::string > &args)
bool show_hash_rate(const std::vector< std::string > &args)
bool unban(const std::vector< std::string > &args)
bool print_connections(const std::vector< std::string > &args)
bool stop_daemon(const std::vector< std::string > &args)
bool stop_mining(const std::vector< std::string > &args)
bool sign_message(const std::vector< std::string > &args)
bool print_status(const std::vector< std::string > &args)
bool print_transaction_pool_stats(const std::vector< std::string > &args)
bool save_blockchain(const std::vector< std::string > &args)
bool show_status(const std::vector< std::string > &args)
bool set_log_level(const std::vector< std::string > &args)
bool set_limit_down(const std::vector< std::string > &args)
bool hard_fork_info(const std::vector< std::string > &args)
bool print_block(const std::vector< std::string > &args)
bool start_mining(const std::vector< std::string > &args)
bool set_limit(int64_t limit_down, int64_t limit_up)
bool check_blockchain_pruning()
bool ban(const std::string &ip, time_t seconds)
bool is_key_image_spent(const crypto::key_image &ki)
bool print_transaction_pool_stats()
bool output_histogram(const std::vector< uint64_t > &amounts, uint64_t min_count, uint64_t max_count)
bool print_block_by_height(uint64_t height, bool include_hex)
bool print_transaction(crypto::hash transaction_hash, bool include_hex, bool include_json)
bool print_transaction_pool_short()
bool print_blockchain_info(uint64_t start_block_index, uint64_t end_block_index)
bool hard_fork_info(uint8_t version)
bool print_peer_list_stats()
bool alt_chain_info(const std::string &tip)
bool set_validator_key(const std::string &key)
bool sign_message(const std::string privateKey, const std::string message)
bool print_transaction_pool_long()
bool generate_ed25519_keypair()
bool print_blockchain_dynamic_stats(uint64_t nblocks)
bool set_log_level(int8_t level)
bool in_peers(uint64_t limit)
bool start_mining(cryptonote::account_public_address address, uint64_t num_threads, cryptonote::network_type nettype, bool do_background_mining=false, bool ignore_battery=false)
bool unban(const std::string &ip)
bool print_coinbase_tx_sum(uint64_t height, uint64_t count)
bool print_peer_list(bool white=true, bool gray=true, size_t limit=0)
bool pop_blocks(uint64_t num_blocks)
bool update(const std::string &command)
bool set_log_categories(const std::string &categories)
bool flush_txpool(const std::string &txid)
bool relay_tx(const std::string &txid)
bool out_peers(uint64_t limit)
bool print_block_by_hash(crypto::hash block_hash, bool include_hex)
bool parse_hash256(const std::string &str_hash, crypto::hash &hash)
void * memcpy(void *a, const void *b, size_t c)
bool is_no(const std::string &str)
bool is_yes(const std::string &str)
bool get_account_address_from_str(address_parse_info &info, network_type nettype, std::string const &str)
mdb_size_t count(MDB_cursor *cur)
boost::endian::big_uint16_t port
boost::endian::big_uint32_t ip
unsigned __int64 uint64_t
const char *const ELECTRONEUM_RELEASE_NAME
const char *const ELECTRONEUM_VERSION_FULL