diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-03-03 18:56:46 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-03-03 18:56:46 +0200 |
commit | 3e761c137da73b9f82c8c26f8896e8781dbf062e (patch) | |
tree | 7df46c322b5f5f0de30df1086890014638d7fa02 /src/blockchain_db | |
parent | Merge pull request #1831 (diff) | |
parent | Remove redundant num_txs() method (diff) | |
download | monero-3e761c137da73b9f82c8c26f8896e8781dbf062e.tar.xz |
Merge pull request #1832
eb62dcc8 Remove redundant num_txs() method (Howard Chu)
296641e0 Fix #1824 don't end batch that we didn't start (Howard Chu)
Diffstat (limited to 'src/blockchain_db')
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 21 | ||||
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.h | 1 |
2 files changed, 4 insertions, 18 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index a590ca135..c7266f19e 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -749,7 +749,7 @@ uint64_t BlockchainLMDB::add_transaction_data(const crypto::hash& blk_hash, cons uint64_t m_height = height(); int result; - uint64_t tx_id = num_txs(); + uint64_t tx_id = get_tx_count(); CURSOR(txs) CURSOR(tx_indices) @@ -1741,20 +1741,6 @@ uint64_t BlockchainLMDB::height() const return db_stats.ms_entries; } -uint64_t BlockchainLMDB::num_txs() const -{ - LOG_PRINT_L3("BlockchainLMDB::" << __func__); - check_open(); - TXN_PREFIX_RDONLY(); - int result; - - // get current height - MDB_stat db_stats; - if ((result = mdb_stat(m_txn, m_txs, &db_stats))) - throw0(DB_ERROR(lmdb_error("Failed to query m_txs: ", result).c_str())); - return db_stats.ms_entries; -} - uint64_t BlockchainLMDB::num_outputs() const { LOG_PRINT_L3("BlockchainLMDB::" << __func__); @@ -1900,10 +1886,11 @@ uint64_t BlockchainLMDB::get_tx_count() const check_open(); TXN_PREFIX_RDONLY(); + int result; MDB_stat db_stats; - if (mdb_stat(m_txn, m_tx_indices, &db_stats)) - throw0(DB_ERROR("Failed to query m_tx_indices")); + if ((result = mdb_stat(m_txn, m_txs, &db_stats))) + throw0(DB_ERROR(lmdb_error("Failed to query m_txs: ", result).c_str())); TXN_POSTFIX_RDONLY(); diff --git a/src/blockchain_db/lmdb/db_lmdb.h b/src/blockchain_db/lmdb/db_lmdb.h index ade7b6a76..8a5677566 100644 --- a/src/blockchain_db/lmdb/db_lmdb.h +++ b/src/blockchain_db/lmdb/db_lmdb.h @@ -310,7 +310,6 @@ private: virtual void remove_spent_key(const crypto::key_image& k_image); - uint64_t num_txs() const; uint64_t num_outputs() const; // Hard fork |