CurrentBlockchainStatus::read_mempool test added

pull/93/merge
moneroexamples 6 years ago
parent d542aae542
commit 168a0355d6

@ -30,6 +30,7 @@ if (*help_opt)
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
// setup monero logger
mlog_configure(mlog_get_default_log_path(""), true); mlog_configure(mlog_get_default_log_path(""), true);
mlog_set_log("1"); mlog_set_log("1");
@ -70,7 +71,7 @@ cryptonote::network_type nettype = testnet ?
cryptonote::network_type::STAGENET : cryptonote::network_type::MAINNET; cryptonote::network_type::STAGENET : cryptonote::network_type::MAINNET;
// create blockchainsetup instance and set its parameters // create blockchainsetup instance and set its parameters
// suc as blockchain status monitoring thread parameters // such as blockchain status monitoring thread parameters
xmreg::BlockchainSetup bc_setup {nettype, do_not_relay, *config_file_opt}; xmreg::BlockchainSetup bc_setup {nettype, do_not_relay, *config_file_opt};
@ -94,8 +95,8 @@ xmreg::MySqlConnector::dbname = config_json["database"]["dbname"];
// once we have all the parameters for the blockchain and our backend // once we have all the parameters for the blockchain and our backend
// we can create and instance of CurrentBlockchainStatus class. // we can create and instance of CurrentBlockchainStatus class.
// we are going to this through a shared pointer. This way we will // we are going to do this through a shared pointer. This way we will
// have only once instance of this class, which we can easly inject // have only once instance of this class, which we can easly inject
// and pass around other class which need to access blockchain data // and pass around other class which need to access blockchain data
@ -106,22 +107,15 @@ auto current_bc_status
std::make_unique<xmreg::RPCCalls>(bc_setup.deamon_url)); std::make_unique<xmreg::RPCCalls>(bc_setup.deamon_url));
// since CurrentBlockchainStatus class monitors current status // since CurrentBlockchainStatus class monitors current status
// of the blockchain (e.g., current height), its seems logical to // of the blockchain (e.g., current height) .This is the only class
// make static objects for accessing the blockchain in this class. // that has direct access to blockchain and talks (using rpc calls)
// this way monero accessing blockchain variables (i.e. mcore and core_storage) // with the monero deamon.
// are not passed around like crazy everywhere. Uri( "file:///tmp/dh2048.pem"
// There are here, and this is the only class that
// has direct access to blockchain and talks (using rpc calls)
// with the deamon.
if (!current_bc_status->init_monero_blockchain()) if (!current_bc_status->init_monero_blockchain())
{ {
OMERROR << "Error accessing blockchain."; OMERROR << "Error accessing blockchain.";
return EXIT_FAILURE; return EXIT_FAILURE;
} }
//LOG_PRINT_L0("Initializing source blockchain (BlockchainDB)");
// launch the status monitoring thread so that it keeps track of blockchain // launch the status monitoring thread so that it keeps track of blockchain
// info, e.g., current height. Information from this thread is used // info, e.g., current height. Information from this thread is used
// by tx searching threads that are launched for each user independently, // by tx searching threads that are launched for each user independently,

@ -133,10 +133,14 @@ public:
return core_storage.get_db().get_tx_amount_output_indices(tx_id); return core_storage.get_db().get_tx_amount_output_indices(tx_id);
} }
template<typename... T>
auto get_mempool_txs(T&&... args) const virtual bool
get_mempool_txs(
std::vector<tx_info>& tx_infos,
std::vector<spent_key_image_info>& key_image_infos) const
{ {
return m_mempool.get_transactions_and_spent_keys_info(std::forward<T>(args)...); return m_mempool.get_transactions_and_spent_keys_info(
tx_infos, key_image_infos);
} }
virtual uint64_t virtual uint64_t

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save