aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/testdb.h
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/blockchain_db/testdb.h
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 '')
-rw-r--r--src/blockchain_db/testdb.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/blockchain_db/testdb.h b/src/blockchain_db/testdb.h
index 04fad26a4..1492fb2ae 100644
--- a/src/blockchain_db/testdb.h
+++ b/src/blockchain_db/testdb.h
@@ -55,9 +55,13 @@ public:
virtual bool batch_start(uint64_t batch_num_blocks=0, uint64_t batch_bytes=0) { return true; }
virtual void batch_stop() {}
virtual void set_batch_transactions(bool) {}
- virtual void block_txn_start(bool readonly=false) {}
- virtual void block_txn_stop() {}
- virtual void block_txn_abort() {}
+ virtual void block_wtxn_start() {}
+ virtual void block_wtxn_stop() {}
+ virtual void block_wtxn_abort() {}
+ virtual bool block_rtxn_start() const { return true; }
+ virtual void block_rtxn_stop() const {}
+ virtual void block_rtxn_abort() const {}
+
virtual void drop_hard_fork_info() {}
virtual bool block_exists(const crypto::hash& h, uint64_t *height) const { return false; }
virtual cryptonote::blobdata get_block_blob_from_height(const uint64_t& height) const { return cryptonote::t_serializable_object_to_blob(get_block_from_height(height)); }