aboutsummaryrefslogtreecommitdiff
path: root/src/debug_utilities
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-07-19 11:31:40 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-08-25 18:39:48 +0000
commit5019852adc6133c5842ec9dd71ca63d648f282e8 (patch)
tree69daec1b51968d207c0220a0a35e5ef329310c6a /src/debug_utilities
parentcn_deserialize: support pruned transactions (diff)
downloadmonero-5019852adc6133c5842ec9dd71ca63d648f282e8.tar.xz
cn_deserialize: extract payment ids from extra nonce
Diffstat (limited to 'src/debug_utilities')
-rw-r--r--src/debug_utilities/cn_deserialize.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/debug_utilities/cn_deserialize.cpp b/src/debug_utilities/cn_deserialize.cpp
index af33510be..bf228fe14 100644
--- a/src/debug_utilities/cn_deserialize.cpp
+++ b/src/debug_utilities/cn_deserialize.cpp
@@ -43,6 +43,15 @@ using namespace epee;
using namespace cryptonote;
+static std::string extra_nonce_to_string(const cryptonote::tx_extra_nonce &extra_nonce)
+{
+ if (extra_nonce.nonce.size() == 9 && extra_nonce.nonce[0] == TX_EXTRA_NONCE_ENCRYPTED_PAYMENT_ID)
+ return "encrypted payment ID: " + epee::string_tools::buff_to_hex_nodelimer(extra_nonce.nonce.substr(1));
+ if (extra_nonce.nonce.size() == 33 && extra_nonce.nonce[0] == TX_EXTRA_NONCE_PAYMENT_ID)
+ return "plaintext payment ID: " + epee::string_tools::buff_to_hex_nodelimer(extra_nonce.nonce.substr(1));
+ return epee::string_tools::buff_to_hex_nodelimer(extra_nonce.nonce);
+}
+
static void print_extra_fields(const std::vector<cryptonote::tx_extra_field> &fields)
{
std::cout << "tx_extra has " << fields.size() << " field(s)" << std::endl;
@@ -51,7 +60,7 @@ static void print_extra_fields(const std::vector<cryptonote::tx_extra_field> &fi
std::cout << "field " << n << ": ";
if (typeid(cryptonote::tx_extra_padding) == fields[n].type()) std::cout << "extra padding: " << boost::get<cryptonote::tx_extra_padding>(fields[n]).size << " bytes";
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;
- else if (typeid(cryptonote::tx_extra_nonce) == fields[n].type()) std::cout << "extra nonce: " << epee::string_tools::buff_to_hex_nodelimer(boost::get<cryptonote::tx_extra_nonce>(fields[n]).nonce);
+ 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]));
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;
else if (typeid(cryptonote::tx_extra_additional_pub_keys) == fields[n].type()) std::cout << "additional tx pubkeys: " << boost::join(boost::get<cryptonote::tx_extra_additional_pub_keys>(fields[n]).data | boost::adaptors::transformed([](const crypto::public_key &key){ return epee::string_tools::pod_to_hex(key); }), ", " );
else if (typeid(cryptonote::tx_extra_mysterious_minergate) == fields[n].type()) std::cout << "extra minergate custom: " << epee::string_tools::buff_to_hex_nodelimer(boost::get<cryptonote::tx_extra_mysterious_minergate>(fields[n]).data);