From 7d27c26962e8bff4b259abfc06716c95e86cd08a Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Thu, 8 Dec 2016 05:41:18 +0800 Subject: [PATCH] fix: mixin of tx in mempool is correct now --- src/page.h | 2 +- src/tools.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/page.h b/src/page.h index e70e5eb..ff17c23 100644 --- a/src/page.h +++ b/src/page.h @@ -696,7 +696,7 @@ public: uint64_t mixin_no = 0; if (!mixin_numbers.empty()) - mixin_numbers.at(0) - 1; + mixin_no = mixin_numbers.at(0) - 1; // set output page template map txs.push_back(mstch::map { diff --git a/src/tools.cpp b/src/tools.cpp index 13332db..cc70900 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -509,9 +509,25 @@ get_mixin_no(const string& json_str) { vector mixin_no; + json j; + + try + { + j = json::parse(json_str); + + mixin_no.push_back(j["vin"].at(0)["key"]["key_offsets"].size()); + } + catch (std::invalid_argument& e) + { + cerr << "get_mixin_no: " << e.what() << endl; + return mixin_no; + } + return mixin_no; } + + vector get_mixin_no_in_txs(const vector& txs) {