Electroneum
Loading...
Searching...
No Matches
command_parser_executor.cpp
Go to the documentation of this file.
1// Copyrights(c) 2017-2021, The Electroneum Project
2// Copyrights(c) 2014-2019, The Monero Project
3//
4// All rights reserved.
5//
6// Redistribution and use in source and binary forms, with or without modification, are
7// permitted provided that the following conditions are met:
8//
9// 1. Redistributions of source code must retain the above copyright notice, this list of
10// conditions and the following disclaimer.
11//
12// 2. Redistributions in binary form must reproduce the above copyright notice, this list
13// of conditions and the following disclaimer in the documentation and/or other
14// materials provided with the distribution.
15//
16// 3. Neither the name of the copyright holder nor the names of its contributors may be
17// used to endorse or promote products derived from this software without specific
18// prior written permission.
19//
20// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
21// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
28// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30#include "common/dns_utils.h"
31#include "common/command_line.h"
32#include "version.h"
34
35#undef ELECTRONEUM_DEFAULT_LOG_CATEGORY
36#define ELECTRONEUM_DEFAULT_LOG_CATEGORY "daemon"
37
38namespace daemonize {
39
41 uint32_t ip
42 , uint16_t port
43 , const boost::optional<tools::login>& login
44 , const epee::net_utils::ssl_options_t& ssl_options
45 , bool is_rpc
46 , cryptonote::core_rpc_server* rpc_server
47 )
48 : m_executor(ip, port, login, ssl_options, is_rpc, rpc_server)
49{}
50
51bool t_command_parser_executor::print_peer_list(const std::vector<std::string>& args)
52{
53 if (args.size() > 3)
54 {
55 std::cout << "use: print_pl [white] [gray] [<limit>]" << std::endl;
56 return true;
57 }
58
59 bool white = false;
60 bool gray = false;
61 size_t limit = 0;
62 for (size_t i = 0; i < args.size(); ++i)
63 {
64 if (args[i] == "white")
65 {
66 white = true;
67 }
68 else if (args[i] == "gray")
69 {
70 gray = true;
71 }
72 else if (!epee::string_tools::get_xtype_from_string(limit, args[i]))
73 {
74 std::cout << "unexpected argument: " << args[i] << std::endl;
75 return true;
76 }
77 }
78
79 const bool print_both = !white && !gray;
80 return m_executor.print_peer_list(white | print_both, gray | print_both, limit);
81}
82
83bool t_command_parser_executor::print_peer_list_stats(const std::vector<std::string>& args)
84{
85 if (!args.empty()) return false;
86
87 return m_executor.print_peer_list_stats();
88}
89
90bool t_command_parser_executor::save_blockchain(const std::vector<std::string>& args)
91{
92 if (!args.empty()) return false;
93
94 return m_executor.save_blockchain();
95}
96
97bool t_command_parser_executor::show_hash_rate(const std::vector<std::string>& args)
98{
99 if (!args.empty()) return false;
100
101 return m_executor.show_hash_rate();
102}
103
104bool t_command_parser_executor::hide_hash_rate(const std::vector<std::string>& args)
105{
106 if (!args.empty()) return false;
107
108 return m_executor.hide_hash_rate();
109}
110
111bool t_command_parser_executor::show_difficulty(const std::vector<std::string>& args)
112{
113 if (!args.empty()) return false;
114
115 return m_executor.show_difficulty();
116}
117
118bool t_command_parser_executor::show_status(const std::vector<std::string>& args)
119{
120 if (!args.empty()) return false;
121
122 return m_executor.show_status();
123}
124
125bool t_command_parser_executor::print_connections(const std::vector<std::string>& args)
126{
127 if (!args.empty()) return false;
128
129 return m_executor.print_connections();
130}
131
132bool t_command_parser_executor::print_net_stats(const std::vector<std::string>& args)
133{
134 if (!args.empty()) return false;
135
136 return m_executor.print_net_stats();
137}
138
139bool t_command_parser_executor::print_blockchain_info(const std::vector<std::string>& args)
140{
141 if(!args.size())
142 {
143 std::cout << "need block index parameter" << std::endl;
144 return false;
145 }
146 uint64_t start_index = 0;
147 uint64_t end_index = 0;
148 if(!epee::string_tools::get_xtype_from_string(start_index, args[0]))
149 {
150 std::cout << "wrong starter block index parameter" << std::endl;
151 return false;
152 }
153 if(args.size() >1 && !epee::string_tools::get_xtype_from_string(end_index, args[1]))
154 {
155 std::cout << "wrong end block index parameter" << std::endl;
156 return false;
157 }
158
159 return m_executor.print_blockchain_info(start_index, end_index);
160}
161
162bool t_command_parser_executor::set_log_level(const std::vector<std::string>& args)
163{
164 if(args.size() > 1)
165 {
166 std::cout << "use: set_log [<log_level_number_0-4> | <categories>]" << std::endl;
167 return true;
168 }
169
170 if (args.empty())
171 {
172 return m_executor.set_log_categories("+");
173 }
174
175 uint16_t l = 0;
177 {
178 if(4 < l)
179 {
180 std::cout << "wrong number range, use: set_log <log_level_number_0-4>" << std::endl;
181 return true;
182 }
183 return m_executor.set_log_level(l);
184 }
185 else
186 {
187 return m_executor.set_log_categories(args.front());
188 }
189}
190
191bool t_command_parser_executor::print_height(const std::vector<std::string>& args)
192{
193 if (!args.empty()) return false;
194
195 return m_executor.print_height();
196}
197
198bool t_command_parser_executor::print_block(const std::vector<std::string>& args)
199{
200 bool include_hex = false;
201
202 // Assumes that optional flags come after mandatory argument <transaction_hash>
203 for (unsigned int i = 1; i < args.size(); ++i) {
204 if (args[i] == "+hex")
205 include_hex = true;
206 else
207 {
208 std::cout << "unexpected argument: " << args[i] << std::endl;
209 return true;
210 }
211 }
212 if (args.empty())
213 {
214 std::cout << "expected: print_block (<block_hash> | <block_height>) [+hex]" << std::endl;
215 return false;
216 }
217
218 const std::string& arg = args.front();
219 try
220 {
221 uint64_t height = boost::lexical_cast<uint64_t>(arg);
222 return m_executor.print_block_by_height(height, include_hex);
223 }
224 catch (const boost::bad_lexical_cast&)
225 {
226 crypto::hash block_hash;
227 if (parse_hash256(arg, block_hash))
228 {
229 return m_executor.print_block_by_hash(block_hash, include_hex);
230 }
231 }
232
233 return false;
234}
235
236bool t_command_parser_executor::print_transaction(const std::vector<std::string>& args)
237{
238 bool include_hex = false;
239 bool include_json = false;
240
241 // Assumes that optional flags come after mandatory argument <transaction_hash>
242 for (unsigned int i = 1; i < args.size(); ++i) {
243 if (args[i] == "+hex")
244 include_hex = true;
245 else if (args[i] == "+json")
246 include_json = true;
247 else
248 {
249 std::cout << "unexpected argument: " << args[i] << std::endl;
250 return true;
251 }
252 }
253 if (args.empty())
254 {
255 std::cout << "expected: print_tx <transaction_hash> [+hex] [+json]" << std::endl;
256 return true;
257 }
258
259 const std::string& str_hash = args.front();
260 crypto::hash tx_hash;
261 if (parse_hash256(str_hash, tx_hash))
262 {
263 m_executor.print_transaction(tx_hash, include_hex, include_json);
264 }
265
266 return true;
267}
268
269bool t_command_parser_executor::is_key_image_spent(const std::vector<std::string>& args)
270{
271 if (args.empty())
272 {
273 std::cout << "expected: is_key_image_spent <key_image>" << std::endl;
274 return true;
275 }
276
277 const std::string& str = args.front();
279 crypto::hash hash;
280 if (parse_hash256(str, hash))
281 {
282 memcpy(&ki, &hash, sizeof(ki));
283 m_executor.is_key_image_spent(ki);
284 }
285
286 return true;
287}
288
289bool t_command_parser_executor::is_public_output_spent(const std::vector<std::string>& args) {
290 // Check if the number of arguments is exactly 3
291 if (args.size() != 3) {
292 std::cout << "expected: is_public_output_spent <tx hash> <relative output index> <amount without decimal period, eg 0.01 should be 1>" << std::endl;
293 return true;
294 }
295
296 const std::string &tx_hash_str = args[0];
297 const std::string &relative_output_index_str = args[1];
298 const std::string &amount_str = args[2];
299
300 // Parse the transaction hash
301 crypto::hash tx_hash;
302 if (!parse_hash256(tx_hash_str, tx_hash)) {
303 std::cout << "Invalid transaction hash: " << tx_hash_str << std::endl;
304 return true;
305 }
306
307 // Parse the relative output index
308 uint64_t relative_output_index;
309 if (!epee::string_tools::get_xtype_from_string(relative_output_index, relative_output_index_str)) {
310 std::cout << "Invalid relative output index: " << relative_output_index_str << std::endl;
311 return true;
312 }
313
314 // Parse the amount
315 uint64_t amount;
316 if (!epee::string_tools::get_xtype_from_string(amount, amount_str)) {
317 std::cout << "Invalid amount: " << amount_str << std::endl;
318 return true;
319 }
320
322 txin.tx_hash = tx_hash;
323 txin.relative_offset = relative_output_index;
324 txin.amount = amount;
325
326 // Assuming m_executor.is_public_output_spent needs these parsed values
327 m_executor.is_public_output_spent(txin);
328
329 return true;
330}
331
332bool t_command_parser_executor::print_transaction_pool_long(const std::vector<std::string>& args)
333{
334 if (!args.empty()) return false;
335
336 return m_executor.print_transaction_pool_long();
337}
338
339bool t_command_parser_executor::print_transaction_pool_short(const std::vector<std::string>& args)
340{
341 if (!args.empty()) return false;
342
343 return m_executor.print_transaction_pool_short();
344}
345
346bool t_command_parser_executor::print_transaction_pool_stats(const std::vector<std::string>& args)
347{
348 if (!args.empty()) return false;
349
350 return m_executor.print_transaction_pool_stats();
351}
352
353bool t_command_parser_executor::start_mining(const std::vector<std::string>& args)
354{
355 if(!args.size())
356 {
357 std::cout << "Please specify a wallet address to mine for: start_mining <addr> [<threads>|auto]" << std::endl;
358 return true;
359 }
360
364 {
366 {
368 {
369 bool dnssec_valid;
370 std::string address_str = tools::dns_utils::get_account_address_as_str_from_url(args.front(), dnssec_valid,
371 [](const std::string &url, const std::vector<std::string> &addresses, bool dnssec_valid){return addresses[0];});
373 {
375 {
377 {
378 std::cout << "target account address has wrong format" << std::endl;
379 return true;
380 }
381 else
382 {
383 nettype = cryptonote::STAGENET;
384 }
385 }
386 else
387 {
388 nettype = cryptonote::TESTNET;
389 }
390 }
391 }
392 else
393 {
394 nettype = cryptonote::STAGENET;
395 }
396 }
397 else
398 {
399 nettype = cryptonote::TESTNET;
400 }
401 }
402 if (info.is_subaddress)
403 {
404 tools::fail_msg_writer() << "subaddress for mining reward is not yet supported!" << std::endl;
405 return true;
406 }
407 if(nettype != cryptonote::MAINNET)
408 std::cout << "Mining to a " << (nettype == cryptonote::TESTNET ? "testnet" : "stagenet") << " address, make sure this is intentional!" << std::endl;
409 uint64_t threads_count = 1;
410 bool do_background_mining = false;
411 bool ignore_battery = false;
412 if(args.size() > 4)
413 {
414 return false;
415 }
416
417 if(args.size() == 4)
418 {
419 if(args[3] == "true" || command_line::is_yes(args[3]) || args[3] == "1")
420 {
421 ignore_battery = true;
422 }
423 else if(args[3] != "false" && !command_line::is_no(args[3]) && args[3] != "0")
424 {
425 return false;
426 }
427 }
428
429 if(args.size() >= 3)
430 {
431 if(args[2] == "true" || command_line::is_yes(args[2]) || args[2] == "1")
432 {
433 do_background_mining = true;
434 }
435 else if(args[2] != "false" && !command_line::is_no(args[2]) && args[2] != "0")
436 {
437 return false;
438 }
439 }
440
441 if(args.size() >= 2)
442 {
443 if (args[1] == "auto" || args[1] == "autodetect")
444 {
445 threads_count = 0;
446 }
447 else
448 {
449 bool ok = epee::string_tools::get_xtype_from_string(threads_count, args[1]);
450 threads_count = (ok && 0 < threads_count) ? threads_count : 1;
451 }
452 }
453
454 m_executor.start_mining(info.address, threads_count, nettype, do_background_mining, ignore_battery);
455
456 return true;
457}
458
459bool t_command_parser_executor::stop_mining(const std::vector<std::string>& args)
460{
461 if (!args.empty()) return false;
462
463 return m_executor.stop_mining();
464}
465
466bool t_command_parser_executor::mining_status(const std::vector<std::string>& args)
467{
468 return m_executor.mining_status();
469}
470
471bool t_command_parser_executor::stop_daemon(const std::vector<std::string>& args)
472{
473 if (!args.empty()) return false;
474
475 return m_executor.stop_daemon();
476}
477
478bool t_command_parser_executor::print_status(const std::vector<std::string>& args)
479{
480 if (!args.empty()) return false;
481
482 return m_executor.print_status();
483}
484
485bool t_command_parser_executor::set_limit(const std::vector<std::string>& args)
486{
487 if(args.size()>1) return false;
488 if(args.size()==0) {
489 return m_executor.get_limit();
490 }
491 int64_t limit;
492 try {
493 limit = std::stoll(args[0]);
494 }
495 catch(const std::exception& ex) {
496 std::cout << "failed to parse argument" << std::endl;
497 return false;
498 }
499
500 return m_executor.set_limit(limit, limit);
501}
502
503bool t_command_parser_executor::set_limit_up(const std::vector<std::string>& args)
504{
505 if(args.size()>1) return false;
506 if(args.size()==0) {
507 return m_executor.get_limit_up();
508 }
509 int64_t limit;
510 try {
511 limit = std::stoll(args[0]);
512 }
513 catch(const std::exception& ex) {
514 std::cout << "failed to parse argument" << std::endl;
515 return false;
516 }
517
518 return m_executor.set_limit(0, limit);
519}
520
521bool t_command_parser_executor::set_limit_down(const std::vector<std::string>& args)
522{
523 if(args.size()>1) return false;
524 if(args.size()==0) {
525 return m_executor.get_limit_down();
526 }
527 int64_t limit;
528 try {
529 limit = std::stoll(args[0]);
530 }
531 catch(const std::exception& ex) {
532 std::cout << "failed to parse argument" << std::endl;
533 return false;
534 }
535
536 return m_executor.set_limit(limit, 0);
537}
538
539bool t_command_parser_executor::out_peers(const std::vector<std::string>& args)
540{
541 if (args.empty()) return false;
542
543 unsigned int limit;
544 try {
545 limit = std::stoi(args[0]);
546 }
547
548 catch(const std::exception& ex) {
549 _erro("stoi exception");
550 return false;
551 }
552
553 return m_executor.out_peers(limit);
554}
555
556bool t_command_parser_executor::in_peers(const std::vector<std::string>& args)
557{
558 if (args.empty()) return false;
559
560 unsigned int limit;
561 try {
562 limit = std::stoi(args[0]);
563 }
564
565 catch(const std::exception& ex) {
566 _erro("stoi exception");
567 return false;
568 }
569
570 return m_executor.in_peers(limit);
571}
572
573bool t_command_parser_executor::start_save_graph(const std::vector<std::string>& args)
574{
575 if (!args.empty()) return false;
576 return m_executor.start_save_graph();
577}
578
579bool t_command_parser_executor::stop_save_graph(const std::vector<std::string>& args)
580{
581 if (!args.empty()) return false;
582 return m_executor.stop_save_graph();
583}
584
585bool t_command_parser_executor::hard_fork_info(const std::vector<std::string>& args)
586{
587 int version;
588 if (args.size() == 0) {
589 version = 0;
590 }
591 else if (args.size() == 1) {
592 try {
593 version = std::stoi(args[0]);
594 }
595 catch(const std::exception& ex) {
596 return false;
597 }
599 return false;
600 }
601 else {
602 return false;
603 }
604 return m_executor.hard_fork_info(version);
605}
606
607bool t_command_parser_executor::show_bans(const std::vector<std::string>& args)
608{
609 if (!args.empty()) return false;
610 return m_executor.print_bans();
611}
612
613bool t_command_parser_executor::ban(const std::vector<std::string>& args)
614{
615 if (args.size() != 1 && args.size() != 2) return false;
616 std::string ip = args[0];
617 time_t seconds = P2P_IP_BLOCKTIME;
618 if (args.size() > 1)
619 {
620 try
621 {
622 if(args[1] == "-1"){
623 seconds = std::numeric_limits<time_t>::max();
624 }
625 else{
626 seconds = std::stoi(args[1]);
627 }
628 }
629 catch (const std::exception &e)
630 {
631 return false;
632 }
633 if (seconds == 0)
634 {
635 return false;
636 }
637 }
638 return m_executor.ban(ip, seconds);
639}
640
641bool t_command_parser_executor::unban(const std::vector<std::string>& args)
642{
643 if (args.size() != 1) return false;
644 std::string ip = args[0];
645 return m_executor.unban(ip);
646}
647
648bool t_command_parser_executor::flush_txpool(const std::vector<std::string>& args)
649{
650 if (args.size() > 1) return false;
651
652 std::string txid;
653 if (args.size() == 1)
654 {
655 crypto::hash hash;
656 if (!parse_hash256(args[0], hash))
657 {
658 std::cout << "failed to parse tx id" << std::endl;
659 return true;
660 }
661 txid = args[0];
662 }
663 return m_executor.flush_txpool(txid);
664}
665
666bool t_command_parser_executor::output_histogram(const std::vector<std::string>& args)
667{
668 std::vector<uint64_t> amounts;
669 uint64_t min_count = 3;
670 uint64_t max_count = 0;
671 size_t n_raw = 0;
672
673 for (size_t n = 0; n < args.size(); ++n)
674 {
675 if (args[n][0] == '@')
676 {
677 amounts.push_back(boost::lexical_cast<uint64_t>(args[n].c_str() + 1));
678 }
679 else if (n_raw == 0)
680 {
681 min_count = boost::lexical_cast<uint64_t>(args[n]);
682 n_raw++;
683 }
684 else if (n_raw == 1)
685 {
686 max_count = boost::lexical_cast<uint64_t>(args[n]);
687 n_raw++;
688 }
689 else
690 {
691 std::cout << "Invalid syntax: more than two non-amount parameters" << std::endl;
692 return true;
693 }
694 }
695 return m_executor.output_histogram(amounts, min_count, max_count);
696}
697
698bool t_command_parser_executor::print_coinbase_tx_sum(const std::vector<std::string>& args)
699{
700 if(!args.size())
701 {
702 std::cout << "need block height parameter" << std::endl;
703 return false;
704 }
705 uint64_t height = 0;
706 uint64_t count = 0;
708 {
709 std::cout << "wrong starter block height parameter" << std::endl;
710 return false;
711 }
712 if(args.size() >1 && !epee::string_tools::get_xtype_from_string(count, args[1]))
713 {
714 std::cout << "wrong count parameter" << std::endl;
715 return false;
716 }
717
718 return m_executor.print_coinbase_tx_sum(height, count);
719}
720
721bool t_command_parser_executor::alt_chain_info(const std::vector<std::string>& args)
722{
723 if(args.size() > 1)
724 {
725 std::cout << "usage: alt_chain_info [block_hash]" << std::endl;
726 return false;
727 }
728
729 return m_executor.alt_chain_info(args.size() == 1 ? args[0] : "");
730}
731
732bool t_command_parser_executor::print_blockchain_dynamic_stats(const std::vector<std::string>& args)
733{
734 if(args.size() != 1)
735 {
736 std::cout << "Exactly one parameter is needed" << std::endl;
737 return false;
738 }
739
740 uint64_t nblocks = 0;
741 if(!epee::string_tools::get_xtype_from_string(nblocks, args[0]) || nblocks == 0)
742 {
743 std::cout << "wrong number of blocks" << std::endl;
744 return false;
745 }
746
747 return m_executor.print_blockchain_dynamic_stats(nblocks);
748}
749
750bool t_command_parser_executor::update(const std::vector<std::string>& args)
751{
752 if(args.size() != 1)
753 {
754 std::cout << "Exactly one parameter is needed: check, download, or update" << std::endl;
755 return false;
756 }
757
758 return m_executor.update(args.front());
759}
760
761bool t_command_parser_executor::relay_tx(const std::vector<std::string>& args)
762{
763 if (args.size() != 1) return false;
764
765 std::string txid;
766 crypto::hash hash;
767 if (!parse_hash256(args[0], hash))
768 {
769 std::cout << "failed to parse tx id" << std::endl;
770 return true;
771 }
772 txid = args[0];
773 return m_executor.relay_tx(txid);
774}
775
776bool t_command_parser_executor::sync_info(const std::vector<std::string>& args)
777{
778 if (args.size() != 0) return false;
779
780 return m_executor.sync_info();
781}
782
783bool t_command_parser_executor::pop_blocks(const std::vector<std::string>& args)
784{
785 if (args.size() != 1)
786 {
787 std::cout << "Exactly one parameter is needed" << std::endl;
788 return false;
789 }
790
791 try
792 {
793 uint64_t nblocks = boost::lexical_cast<uint64_t>(args[0]);
794 if (nblocks < 1)
795 {
796 std::cout << "number of blocks must be greater than 0" << std::endl;
797 return false;
798 }
799 return m_executor.pop_blocks(nblocks);
800 }
801 catch (const boost::bad_lexical_cast&)
802 {
803 std::cout << "number of blocks must be a number greater than 0" << std::endl;
804 }
805 return false;
806}
807
808bool t_command_parser_executor::version(const std::vector<std::string>& args)
809{
810 std::cout << "Electroneum '" << ELECTRONEUM_RELEASE_NAME << "' (v" << ELECTRONEUM_VERSION_FULL << ")" << std::endl;
811 return true;
812}
813
814bool t_command_parser_executor::prune_blockchain(const std::vector<std::string>& args)
815{
816 if (args.size() > 1) return false;
817
818 if (args.empty() || args[0] != "confirm")
819 {
820 std::cout << "Warning: pruning from within electroneumd will not shrink the database file size." << std::endl;
821 std::cout << "Instead, parts of the file will be marked as free, so the file will not grow" << std::endl;
822 std::cout << "until that newly free space is used up. If you want a smaller file size now," << std::endl;
823 std::cout << "exit electroneumd and run electroneum-blockchain-prune (you will temporarily need more" << std::endl;
824 std::cout << "disk space for the database conversion though). If you are OK with the database" << std::endl;
825 std::cout << "file keeping the same size, re-run this command with the \"confirm\" parameter." << std::endl;
826 return true;
827 }
828
829 return m_executor.prune_blockchain();
830}
831
832bool t_command_parser_executor::check_blockchain_pruning(const std::vector<std::string>& args)
833{
834 return m_executor.check_blockchain_pruning();
835}
836
837bool t_command_parser_executor::set_validator_key(const std::vector<std::string>& args)
838{
839 if(args.size() != 1) return false;
840
841 std::string key(args[0]);
842
843 bool is_validator_key_valid = std::count_if(key.begin(), key.end(), [](int c) {return !std::isxdigit(c);}) == 0;
844 if(!is_validator_key_valid || key.size() != 64) {
845 std::cout << "Failed to parse validator key (wrong format)." << std::endl;
846 return true;
847 }
848
849 return m_executor.set_validator_key(key);
850}
851
852bool t_command_parser_executor::generate_ed25519_keypair(const std::vector<std::string>& args)
853{
854 if(args.size() != 0) return false;
855
856 return m_executor.generate_ed25519_keypair();
857}
858
859bool t_command_parser_executor::sign_message(const std::vector<std::string>& args)
860{
861 if(args.size() != 2) return false;
862
863 std::string key(args[0]);
864 return m_executor.sign_message(key, args[1]);
865}
866
867} // namespace daemonize
uint64_t height
uint8_t version
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 is_public_output_spent(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 parse_hash256(const std::string &str_hash, crypto::hash &hash)
#define P2P_IP_BLOCKTIME
void * memcpy(void *a, const void *b, size_t c)
const char * key
#define _erro(x)
bool is_no(const std::string &str)
bool is_yes(const std::string &str)
POD_CLASS key_image
Definition crypto.h:105
POD_CLASS hash
Definition hash.h:50
bool get_account_address_from_str(address_parse_info &info, network_type nettype, std::string const &str)
PUSH_WARNINGS bool get_xtype_from_string(OUT XType &val, const std::string &str_id)
std::string get_account_address_as_str_from_url(const std::string &url, bool &dnssec_valid, std::function< std::string(const std::string &, const std::vector< std::string > &, bool)> dns_confirm)
scoped_message_writer fail_msg_writer()
CXA_THROW_INFO_T * info
unsigned short uint16_t
Definition stdint.h:125
signed __int64 int64_t
Definition stdint.h:135
unsigned int uint32_t
Definition stdint.h:126
unsigned __int64 uint64_t
Definition stdint.h:136
const char *const ELECTRONEUM_RELEASE_NAME
const char *const ELECTRONEUM_VERSION_FULL