From 9a8712dd43d1d41900a59092b84fd022420729f2 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Tue, 10 Jan 2017 18:43:50 +0800 Subject: [PATCH 1/2] checking what's happening with mempool json --- src/page.h | 5 +++++ src/tools.cpp | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/page.h b/src/page.h index 42f1d7f..c1e31fe 100644 --- a/src/page.h +++ b/src/page.h @@ -4347,6 +4347,11 @@ private: { transaction tx; + if (_tx_info.id_hash != "edb1e71c24a6a3c1ce101d68c7525d6422c09d8bfe4a8f74adeb04f118211072") + continue; + + cout << "\n\n\n_tx_info.id_hash:" << _tx_info.id_hash << endl; + if (!xmreg::make_tx_from_json(_tx_info.tx_json, tx)) { cerr << "Cant make tx from _tx_info.tx_json" << endl; diff --git a/src/tools.cpp b/src/tools.cpp index 17dfcd9..5f7ece5 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -1023,7 +1023,7 @@ make_tx_from_json(const string& json_str, transaction& tx) } - //cout << "\n\n j.dump()" << j.dump(4) << endl; + cout << "\n\n j.dump()" << j.dump(4) << endl; // get version and unlock time from json tx.version = j["version"].get(); @@ -1248,9 +1248,9 @@ make_tx_from_json(const string& json_str, transaction& tx) } // j.find("rctsig_prunable") != j.end() - //cout << "\nreconstructed: \n" << j.dump(4) << endl; - //cout << "From reconstructed tx: " << obj_to_json_str(tx) << endl; + + cout << "From reconstructed tx: " << obj_to_json_str(tx) << endl; return true; } From cc97b932adc7ac987036ca2d202ef0eb07cb2421 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Wed, 11 Jan 2017 01:09:57 +0000 Subject: [PATCH 2/2] fix: pseudoOuts missing in some ringct txs from mempool --- src/page.h | 5 +--- src/tools.cpp | 68 ++++++++++++++++++++++++++++++++------------------- 2 files changed, 44 insertions(+), 29 deletions(-) diff --git a/src/page.h b/src/page.h index c1e31fe..76c672a 100644 --- a/src/page.h +++ b/src/page.h @@ -4347,10 +4347,7 @@ private: { transaction tx; - if (_tx_info.id_hash != "edb1e71c24a6a3c1ce101d68c7525d6422c09d8bfe4a8f74adeb04f118211072") - continue; - - cout << "\n\n\n_tx_info.id_hash:" << _tx_info.id_hash << endl; + //cout << "\n\n\n_tx_info.id_hash:" << _tx_info.id_hash << endl; if (!xmreg::make_tx_from_json(_tx_info.tx_json, tx)) { diff --git a/src/tools.cpp b/src/tools.cpp index 5f7ece5..cd5f775 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -143,34 +143,34 @@ remove_trailing_path_separator(const bf::path& in_path) return bf::path(remove_trailing_path_separator(path_str)); } -//string -//timestamp_to_str(time_t timestamp, const char* format) -//{ -// auto a_time_point = chrono::system_clock::from_time_t(timestamp); -// -// try -// { -// auto utc = date::to_utc_time(chrono::system_clock::from_time_t(timestamp)); -// auto sys_time = date::to_sys_time(utc); -// -// return date::format(format, date::floor(sys_time)); -// } -// catch (std::runtime_error& e) -// { -// cerr << "xmreg::timestamp_to_str: " << e.what() << endl; -// cerr << "Seems cant convert to UTC timezone using date library. " -// "So just use local timezone." <(sys_time)); + } + catch (std::runtime_error& e) + { + cerr << "xmreg::timestamp_to_str: " << e.what() << endl; + cerr << "Seems cant convert to UTC timezone using date library. " + "So just use local timezone." <(); @@ -1121,6 +1121,24 @@ make_tx_from_json(const string& json_str, transaction& tx) { rct::rctSig& rct_signatures = tx.rct_signatures; + if (j["rct_signatures"].find("pseudoOuts") != j["rct_signatures"].end()) + { + rct::keyV& pseudoOuts = rct_signatures.pseudoOuts; + + for (json& pOut: j["rct_signatures"]["pseudoOuts"]) + { + rct::key pOut_key; + + if (!epee::string_tools::hex_to_pod(pOut, pOut_key)) + { + cerr << "Faild to parse pOut_key of pseudoOuts from json" << endl; + return false; + } + + pseudoOuts.push_back(pOut_key); + } + } + vector& ecdhInfo = rct_signatures.ecdhInfo; for (json& ecdhI: j["rct_signatures"]["ecdhInfo"]) @@ -1250,7 +1268,7 @@ make_tx_from_json(const string& json_str, transaction& tx) - cout << "From reconstructed tx: " << obj_to_json_str(tx) << endl; + //cout << "From reconstructed tx: " << obj_to_json_str(tx) << endl; return true; }