76{
78 std::string input;
79
81
82 boost::filesystem::path output_file_path;
83
84 po::options_description desc_cmd_only("Command line options");
85 po::options_description desc_cmd_sett("Command line options and settings options");
88
91
93
94 po::options_description desc_options("Allowed options");
95 desc_options.add(desc_cmd_only).add(desc_cmd_sett);
96
97 po::variables_map vm;
99 {
100 po::store(po::parse_command_line(argc, argv, desc_options), vm);
101 po::notify(vm);
102 return true;
103 });
104 if (! r)
105 return 1;
106
108 {
110 std::cout << desc_options << std::endl;
111 return 1;
112 }
113
116 if (input.empty())
117 {
118 std::cerr << "--input is mandatory" << std::endl;
119 return 1;
120 }
121
123
126 {
127 std::cerr << "Invalid hex input" << std::endl;
128 return 1;
129 }
130
134 std::vector<cryptonote::tx_extra_field> fields;
136 {
137 std::cout << "Parsed block:" << std::endl;
139 }
141 {
143 std::cout << "Parsed pruned transaction:" << std::endl;
144 else
145 std::cout << "Parsed transaction:" << std::endl;
147
149 if (!parsed)
150 std::cout << "Failed to parse tx_extra" << std::endl;
151
152 if (!fields.empty())
153 {
154 print_extra_fields(fields);
155 }
156 else
157 {
158 std::cout << "No fields were found in tx_extra" << std::endl;
159 }
160 }
161 else if (((full =
cryptonote::parse_tx_extra(std::vector<uint8_t>(blob.begin(), blob.end()), fields)) ||
true) && !fields.empty())
162 {
163 std::cout <<
"Parsed" << (
full ?
"" :
" partial") <<
" tx_extra:" << std::endl;
164 print_extra_fields(fields);
165 }
166 else
167 {
168 std::cerr << "Not a recognized CN type" << std::endl;
169 return 1;
170 }
171
172
173
174 return 0;
175}
std::vector< uint8_t > extra
void mlog_configure(const std::string &filename_base, bool console, const std::size_t max_log_file_size=MAX_LOG_FILE_SIZE, const std::size_t max_log_files=MAX_LOG_FILES)
void add_arg(boost::program_options::options_description &description, const arg_descriptor< T, required, dependent, NUM_DEPS > &arg, bool unique=true)
const arg_descriptor< bool > arg_help
bool handle_error_helper(const boost::program_options::options_description &desc, F parser)
T get_arg(const boost::program_options::variables_map &vm, const arg_descriptor< T, false, true > &arg)
std::string obj_to_json_str(T &obj)
bool parse_and_validate_block_from_blob(const blobdata &b_blob, block &b, crypto::hash *block_hash)
bool parse_tx_extra(const std::vector< uint8_t > &tx_extra, std::vector< tx_extra_field > &tx_extra_fields)
bool parse_and_validate_tx_from_blob(const blobdata &tx_blob, transaction &tx)
bool parse_and_validate_tx_base_from_blob(const blobdata &tx_blob, transaction &tx)
const command_line::arg_descriptor< std::string > arg_log_level
const char *const ELECTRONEUM_RELEASE_NAME
const char *const ELECTRONEUM_VERSION_FULL