diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-10-05 23:12:11 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-10-05 23:12:11 +0200 |
commit | 6762897f70138a990c3b2150befd28016c088fe0 (patch) | |
tree | 0d0a9109557d77c104d806a5649e160b4f44286d /src | |
parent | Merge pull request #4485 (diff) | |
parent | Fix rtxn usage in BlockchainLMDB::get_estimated_batch_size (diff) | |
download | monero-6762897f70138a990c3b2150befd28016c088fe0.tar.xz |
Merge pull request #4487
7c790f11 Fix rtxn usage in BlockchainLMDB::get_estimated_batch_size (Howard Chu)
Diffstat (limited to 'src')
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index 824598f8c..bd91f308a 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -649,7 +649,7 @@ uint64_t BlockchainLMDB::get_estimated_batch_size(uint64_t batch_num_blocks, uin { MDB_txn *rtxn; mdb_txn_cursors *rcurs; - block_rtxn_start(&rtxn, &rcurs); + bool my_rtxn = block_rtxn_start(&rtxn, &rcurs); for (uint64_t block_num = block_start; block_num <= block_stop; ++block_num) { // we have access to block weight, which will be greater or equal to block size, @@ -661,7 +661,7 @@ uint64_t BlockchainLMDB::get_estimated_batch_size(uint64_t batch_num_blocks, uin // some blocks were to be skipped for being outliers. ++num_blocks_used; } - block_rtxn_stop(); + if (my_rtxn) block_rtxn_stop(); avg_block_size = total_block_size / num_blocks_used; MDEBUG("average block size across recent " << num_blocks_used << " blocks: " << avg_block_size); } |