aboutsummaryrefslogtreecommitdiff
path: root/src/db.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2015-03-03 07:49:12 -0800
committerPieter Wuille <pieter.wuille@gmail.com>2015-03-03 09:01:46 -0800
commit51598b26319bf1ee98b399dee8152b902c62891a (patch)
tree21805efdbe19e67f3ed953695cb5f27c9d4ff4fe /src/db.h
parent86eb461c5bbe8200ab066f75b5acdf79fbae1086 (diff)
Reinitialize state in between individual unit tests.
This changes the TestingSetup fixture to be per-unit-test rather than global. Most tests don't need it, so it's only invoked in a few.
Diffstat (limited to 'src/db.h')
-rw-r--r--src/db.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/db.h b/src/db.h
index d208907c89..71133f9699 100644
--- a/src/db.h
+++ b/src/db.h
@@ -39,12 +39,14 @@ private:
public:
mutable CCriticalSection cs_db;
- DbEnv dbenv;
+ DbEnv *dbenv;
std::map<std::string, int> mapFileUseCount;
std::map<std::string, Db*> mapDb;
CDBEnv();
~CDBEnv();
+ void Reset();
+
void MakeMock();
bool IsMock() { return fMockDb; }
@@ -79,7 +81,7 @@ public:
DbTxn* TxnBegin(int flags = DB_TXN_WRITE_NOSYNC)
{
DbTxn* ptxn = NULL;
- int ret = dbenv.txn_begin(NULL, &ptxn, flags);
+ int ret = dbenv->txn_begin(NULL, &ptxn, flags);
if (!ptxn || ret != 0)
return NULL;
return ptxn;