From cfcef1d749e0be39ae64e2ba994b528923a852d3 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Wed, 4 Jul 2018 15:45:39 +0800 Subject: [PATCH] fix: compilation error due to get_transactions https://github.com/moneroexamples/onion-monero-blockchain-explorer/issues/134 --- src/CurrentBlockchainStatus.cpp | 4 +- src/MicroCore.cpp | 72 --------------------------------- src/MicroCore.h | 6 --- src/page.h | 12 +++--- 4 files changed, 8 insertions(+), 86 deletions(-) diff --git a/src/CurrentBlockchainStatus.cpp b/src/CurrentBlockchainStatus.cpp index 1a4b1ab..040f01d 100644 --- a/src/CurrentBlockchainStatus.cpp +++ b/src/CurrentBlockchainStatus.cpp @@ -137,8 +137,8 @@ CurrentBlockchainStatus::calculate_emission_in_blocks( uint64_t coinbase_amount = get_outs_money_amount(blk.miner_tx); - std::list txs; - std::list missed_txs; + vector txs; + vector missed_txs; uint64_t tx_fee_amount = 0; diff --git a/src/MicroCore.cpp b/src/MicroCore.cpp index 19f41d8..79dd64f 100644 --- a/src/MicroCore.cpp +++ b/src/MicroCore.cpp @@ -210,78 +210,6 @@ MicroCore::find_output_in_tx(const transaction& tx, } -/** - * Returns tx hash in a given block which - * contains given output's public key - */ -bool -MicroCore::get_tx_hash_from_output_pubkey(const public_key& output_pubkey, - const uint64_t& block_height, - crypto::hash& tx_hash, - cryptonote::transaction& tx_found) -{ - - tx_hash = null_hash; - - // get block of given height - block blk; - if (!get_block_by_height(block_height, blk)) - { - cerr << "Cant get block of height: " << block_height << endl; - return false; - } - - - // get all transactions in the block found - // initialize the first list with transaction for solving - // the block i.e. coinbase. - list txs {blk.miner_tx}; - list missed_txs; - - if (!m_blockchain_storage.get_transactions(blk.tx_hashes, txs, missed_txs)) - { - cerr << "Cant find transcations in block: " << block_height << endl; - return false; - } - - if (!missed_txs.empty()) - { - cerr << "Transactions not found in blk: " << block_height << endl; - - for (const crypto::hash& h : missed_txs) - { - cerr << " - tx hash: " << h << endl; - } - - return false; - } - - - // search outputs in each transactions - // until output with pubkey of interest is found - for (const transaction& tx : txs) - { - - tx_out found_out; - - // we dont need here output_index - size_t output_index; - - if (find_output_in_tx(tx, output_pubkey, found_out, output_index)) - { - // we found the desired public key - tx_hash = get_transaction_hash(tx); - tx_found = tx; - - return true; - } - - } - - return false; -} - - uint64_t MicroCore::get_blk_timestamp(uint64_t blk_height) { diff --git a/src/MicroCore.h b/src/MicroCore.h index 21f9658..0cd5d5e 100644 --- a/src/MicroCore.h +++ b/src/MicroCore.h @@ -59,12 +59,6 @@ namespace xmreg tx_out& out, size_t& output_index); - bool - get_tx_hash_from_output_pubkey(const public_key& output_pubkey, - const uint64_t& block_height, - crypto::hash& tx_hash, - transaction& tx_found); - uint64_t get_blk_timestamp(uint64_t blk_height); diff --git a/src/page.h b/src/page.h index 50d4d9e..b46dfa3 100644 --- a/src/page.h +++ b/src/page.h @@ -783,8 +783,8 @@ public: // get all transactions in the block found // initialize the first list with transaction for solving // the block i.e. coinbase. - list blk_txs {blk.miner_tx}; - list missed_txs; + vector blk_txs {blk.miner_tx}; + vector missed_txs; if (!core_storage->get_transactions(blk.tx_hashes, blk_txs, missed_txs)) { @@ -4671,8 +4671,8 @@ public: json& j_txs = j_blocks.back()["txs"]; - list blk_txs {blk.miner_tx}; - list missed_txs; + vector blk_txs {blk.miner_tx}; + vector missed_txs; if (!core_storage->get_transactions(blk.tx_hashes, blk_txs, missed_txs)) { @@ -5237,8 +5237,8 @@ public: } // get transactions in the given block - list blk_txs{blk.miner_tx}; - list missed_txs; + vector blk_txs{blk.miner_tx}; + vector missed_txs; if (!core_storage->get_transactions(blk.tx_hashes, blk_txs, missed_txs)) {