30 #include <boost/filesystem.hpp> 31 #include <boost/algorithm/string/join.hpp> 32 #include <boost/range/adaptor/transformed.hpp> 39 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY 40 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "debugtools.deserialize" 42 namespace po = boost::program_options;
56 static void print_extra_fields(
const std::vector<cryptonote::tx_extra_field> &fields)
58 std::cout <<
"tx_extra has " << fields.size() <<
" field(s)" << std::endl;
59 for (
size_t n = 0; n < fields.size(); ++n)
61 std::cout <<
"field " << n <<
": ";
62 if (
typeid(
cryptonote::tx_extra_padding) == fields[n].type()) std::cout <<
"extra padding: " << boost::get<cryptonote::tx_extra_padding>(fields[n]).size <<
" bytes";
63 else if (
typeid(
cryptonote::tx_extra_pub_key) == fields[n].type()) std::cout <<
"extra pub key: " << boost::get<cryptonote::tx_extra_pub_key>(fields[n]).pub_key;
64 else if (
typeid(
cryptonote::tx_extra_nonce) == fields[n].type()) std::cout <<
"extra nonce: " << extra_nonce_to_string(boost::get<cryptonote::tx_extra_nonce>(fields[n]));
65 else if (
typeid(
cryptonote::tx_extra_merge_mining_tag) == fields[n].type()) std::cout <<
"extra merge mining tag: depth " << boost::get<cryptonote::tx_extra_merge_mining_tag>(fields[n]).depth <<
", merkle root " << boost::get<cryptonote::tx_extra_merge_mining_tag>(fields[n]).merkle_root;
70 else std::cout <<
"unknown";
71 std::cout << std::endl;
75 int main(
int argc,
char* argv[])
82 boost::filesystem::path output_file_path;
84 po::options_description desc_cmd_only(
"Command line options");
85 po::options_description desc_cmd_sett(
"Command line options and settings options");
94 po::options_description desc_options(
"Allowed options");
95 desc_options.add(desc_cmd_only).add(desc_cmd_sett);
110 std::cout << desc_options << std::endl;
118 std::cerr <<
"--input is mandatory" << std::endl;
127 std::cerr <<
"Invalid hex input" << std::endl;
134 std::vector<cryptonote::tx_extra_field> fields;
137 std::cout <<
"Parsed block:" << std::endl;
143 std::cout <<
"Parsed pruned transaction:" << std::endl;
145 std::cout <<
"Parsed transaction:" << std::endl;
150 std::cout <<
"Failed to parse tx_extra" << std::endl;
154 print_extra_fields(fields);
158 std::cout <<
"No fields were found in tx_extra" << std::endl;
163 std::cout <<
"Parsed" << (
full ?
"" :
" partial") <<
" tx_extra:" << std::endl;
164 print_extra_fields(fields);
168 std::cerr <<
"Not a recognized CN type" << std::endl;
const char *const ELECTRONEUM_RELEASE_NAME
bool parse_tx_extra(const std::vector< uint8_t > &tx_extra, std::vector< tx_extra_field > &tx_extra_fields)
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)
const arg_descriptor< bool > arg_help
std::vector< uint8_t > extra
int main(int argc, char *argv[])
Holds cryptonote related classes and helpers.
const char *const ELECTRONEUM_VERSION_FULL
bool handle_error_helper(const boost::program_options::options_description &desc, F parser)
const command_line::arg_descriptor< std::string > arg_log_level
std::string obj_to_json_str(T &obj)
bool parse_and_validate_tx_base_from_blob(const blobdata &tx_blob, transaction &tx)
bool parse_and_validate_tx_from_blob(const blobdata &tx_blob, transaction &tx)
void add_arg(boost::program_options::options_description &description, const arg_descriptor< T, required, dependent, NUM_DEPS > &arg, bool unique=true)
T get_arg(const boost::program_options::variables_map &vm, const arg_descriptor< T, false, true > &arg)
boost::program_options::basic_parsed_options< charT > parse_command_line(int argc, const charT *const argv[], const boost::program_options::options_description &desc, bool allow_unregistered=false)
bool parse_and_validate_block_from_blob(const blobdata &b_blob, block &b, crypto::hash *block_hash)