aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic/hardfork.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-04-05 09:28:30 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-04-14 08:35:38 +0000
commit5e673c03fec66024027b94229fa2e317d7767a20 (patch)
treecb754f13947b96bf9cbbd74e579d4b7c709a0212 /src/cryptonote_basic/hardfork.cpp
parentMerge pull request #5423 (diff)
downloadmonero-5e673c03fec66024027b94229fa2e317d7767a20.tar.xz
blockchain_db: fix db txn ending too early
The db txn in add_block ending caused the entire overarching batch txn to stop. Also add a new guard class so a db txn can be stopped in the face of exceptions. Also use a read only db txn in init when the db itself is read only, and do not save the max tx size in that case.
Diffstat (limited to 'src/cryptonote_basic/hardfork.cpp')
-rw-r--r--src/cryptonote_basic/hardfork.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/cryptonote_basic/hardfork.cpp b/src/cryptonote_basic/hardfork.cpp
index 89bca2f09..61240ea37 100644
--- a/src/cryptonote_basic/hardfork.cpp
+++ b/src/cryptonote_basic/hardfork.cpp
@@ -266,11 +266,9 @@ bool HardFork::reorganize_from_chain_height(uint64_t height)
bool HardFork::rescan_from_block_height(uint64_t height)
{
CRITICAL_REGION_LOCAL(lock);
- db.block_txn_start(true);
- if (height >= db.height()) {
- db.block_txn_stop();
+ db_rtxn_guard rtxn_guard(&db);
+ if (height >= db.height())
return false;
- }
versions.clear();
@@ -293,8 +291,6 @@ bool HardFork::rescan_from_block_height(uint64_t height)
current_fork_index = voted;
}
- db.block_txn_stop();
-
return true;
}