From 8bf2730fdc0222421835353837863cb36fc0a87b Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Tue, 18 Jun 2019 23:51:01 +0800 Subject: [PATCH] subaddresses added to mempool scanning --- src/TxSearch.cpp | 31 +++++++++++++++++++++---------- src/TxSearch.h | 2 ++ src/xmregcore | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/TxSearch.cpp b/src/TxSearch.cpp index bbbf897..634f6af 100755 --- a/src/TxSearch.cpp +++ b/src/TxSearch.cpp @@ -11,7 +11,7 @@ #include "db/ssqlses.h" #include "CurrentBlockchainStatus.h" -#include "src/UniversalIdentifier.hpp" + namespace xmreg { @@ -44,6 +44,18 @@ TxSearch::TxSearch(XmrAccount const& _acc, + acc->viewkey); } + // make instance of Account from xmregcore. We need this to be + // able to identify outputs addressed to subaddresses based + // on the primary address + xmregcore_account = xmreg::make_account( + acc->address, acc->viewkey); + + if (!xmregcore_account) + { + throw TxSearchException("Cant create xmregcore_account: " + + acc->address); + } + populate_known_outputs(); // start searching from last block that we searched for @@ -77,13 +89,6 @@ searching_is_ongoing = true; MicroCoreAdapter mcore_addapter {current_bc_status_ptr}; -// make instance of Account from xmregcore. We need this to be -// able to identify outputs addressed to subaddresses based -// on the primary address - -auto xmregcore_account = xmreg::make_account( - acc->address, acc->viewkey); - // we put everything in massive catch, as there are plenty ways in which // an exceptions can be thrown here. Mostly from mysql. // but because this is detatch thread, we cant catch them in main thread. @@ -247,6 +252,12 @@ for (auto const& tx_tuple: txs_data) auto const& outputs_identified = identifier.get()->get(); + if (!outputs_identified.empty()) + { + cout << "outputs_identified.size(): " + << outputs_identified.size() << '\n'; + } + auto total_received = calc_total_xmr(outputs_identified); vector amount_specific_indices; @@ -783,8 +794,8 @@ uint8_t rct_type = (is_rct ? tx.rct_signatures.type : 0); // and inputs in a given tx. auto identifier = make_identifier(tx, - make_unique(&address, &viewkey), - make_unique(&address, &viewkey, + make_unique(xmregcore_account.get()), + make_unique(xmregcore_account.get(), &known_outputs_keys, &mcore_addapter)); diff --git a/src/TxSearch.h b/src/TxSearch.h index adea4aa..d3bf7fe 100755 --- a/src/TxSearch.h +++ b/src/TxSearch.h @@ -1,6 +1,7 @@ #pragma once #include "db/MySqlAccounts.h" +#include "src/UniversalIdentifier.hpp" #include #include @@ -71,6 +72,7 @@ private: // represents a row in mysql's Accounts table shared_ptr acc; + unique_ptr xmregcore_account; // stores known output public keys. // used as a cash to fast look up of diff --git a/src/xmregcore b/src/xmregcore index 447ac6f..4356c98 160000 --- a/src/xmregcore +++ b/src/xmregcore @@ -1 +1 @@ -Subproject commit 447ac6fe53057a85f5468da030af24aacaa3fa61 +Subproject commit 4356c9892b9903da4410f773ea36a6e4c799be5a