diff --git a/src/blockchain_db/blockchain_db.h b/src/blockchain_db/blockchain_db.h index 5bcc63d7f..759200cb2 100644 --- a/src/blockchain_db/blockchain_db.h +++ b/src/blockchain_db/blockchain_db.h @@ -1300,14 +1300,13 @@ public: * @param max_size the maximum size of block/transaction data to return (will be exceeded by one blocks's worth at most, if min_count is met) * @param blocks the returned block/transaction data * @param pruned whether to return full or pruned tx data - * @param skip_coinbase whether to return or skip coinbase transactions (they're in blocks regardless) * @param get_miner_tx_hash whether to calculate and return the miner (coinbase) tx hash * * The call will return at least min_block_count if possible, even if this contravenes max_tx_count * * @return true iff the blocks and transactions were found */ - virtual bool get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector, std::vector>>>& blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const = 0; + virtual bool get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector, std::vector>>>& blocks, bool pruned, bool get_miner_tx_hash) const = 0; /** * @brief fetches the prunable transaction blob with the given hash diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index d5422e9c2..60b6bf78e 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -3242,7 +3242,7 @@ std::vector BlockchainLMDB::get_txids_loose(const crypto::hash& tx return matching_hashes; } -bool BlockchainLMDB::get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector, std::vector>>>& blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const +bool BlockchainLMDB::get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector, std::vector>>>& blocks, bool pruned, bool get_miner_tx_hash) const { LOG_PRINT_L3("BlockchainLMDB::" << __func__); check_open(); @@ -3298,7 +3298,6 @@ bool BlockchainLMDB::get_blocks_from(uint64_t start_height, size_t min_block_cou val_tx_id.mv_size = sizeof(tx_id); } - if (skip_coinbase) { result = mdb_cursor_get(m_cur_txs_pruned, &val_tx_id, &v, op); if (result) @@ -3314,7 +3313,7 @@ bool BlockchainLMDB::get_blocks_from(uint64_t start_height, size_t min_block_cou op = MDB_NEXT; current_block.second.reserve(b.tx_hashes.size()); - num_txes += b.tx_hashes.size() + (skip_coinbase ? 0 : 1); + num_txes += b.tx_hashes.size() + 1; for (const auto &tx_hash: b.tx_hashes) { // get pruned data diff --git a/src/blockchain_db/lmdb/db_lmdb.h b/src/blockchain_db/lmdb/db_lmdb.h index 45b3f3709..e6c2c507d 100644 --- a/src/blockchain_db/lmdb/db_lmdb.h +++ b/src/blockchain_db/lmdb/db_lmdb.h @@ -254,7 +254,7 @@ public: bool get_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const override; bool get_pruned_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const override; bool get_pruned_tx_blobs_from(const crypto::hash& h, size_t count, std::vector &bd) const override; - bool get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector, std::vector>>>& blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const override; + bool get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector, std::vector>>>& blocks, bool pruned, bool get_miner_tx_hash) const override; bool get_prunable_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const override; bool get_prunable_tx_hash(const crypto::hash& tx_hash, crypto::hash &prunable_hash) const override; diff --git a/src/blockchain_db/testdb.h b/src/blockchain_db/testdb.h index c525dda95..788c4bffb 100644 --- a/src/blockchain_db/testdb.h +++ b/src/blockchain_db/testdb.h @@ -70,7 +70,7 @@ public: virtual bool get_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const override { return false; } virtual bool get_pruned_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const override { return false; } virtual bool get_pruned_tx_blobs_from(const crypto::hash& h, size_t count, std::vector &bd) const override { return false; } - virtual bool get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector, std::vector>>>& blocks, bool pruned, bool skip_coinbase, bool get_miner_tx_hash) const override { return false; } + virtual bool get_blocks_from(uint64_t start_height, size_t min_block_count, size_t max_block_count, size_t max_tx_count, size_t max_size, std::vector, std::vector>>>& blocks, bool pruned, bool get_miner_tx_hash) const override { return false; } virtual std::vector get_txids_loose(const crypto::hash& h, std::uint32_t bits, uint64_t max_num_txs = 0) override { return {}; } virtual bool get_prunable_tx_blob(const crypto::hash& h, cryptonote::blobdata &tx) const override { return false; } virtual bool get_prunable_tx_hash(const crypto::hash& tx_hash, crypto::hash &prunable_hash) const override { return false; } diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 552dbb646..b69bb00d6 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -2765,7 +2765,7 @@ bool Blockchain::find_blockchain_supplement(const uint64_t req_start_block, cons top_hash = m_db->top_block_hash(&total_height); ++total_height; blocks.reserve(std::min(std::min(max_block_count, (size_t)10000), (size_t)(total_height - start_height))); - CHECK_AND_ASSERT_MES(m_db->get_blocks_from(start_height, 3, max_block_count, max_tx_count, FIND_BLOCKCHAIN_SUPPLEMENT_MAX_SIZE, blocks, pruned, true, get_miner_tx_hash), + CHECK_AND_ASSERT_MES(m_db->get_blocks_from(start_height, 3, max_block_count, max_tx_count, FIND_BLOCKCHAIN_SUPPLEMENT_MAX_SIZE, blocks, pruned, get_miner_tx_hash), false, "Error getting blocks"); return true;