Bugfix: Check proof-of-stake after orphan maps were properly updated
[novacoin.git] / src / txdb-leveldb.cpp
index 1cf3c68..fb4b13f 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "kernel.h"
 #include "checkpoints.h"
-#include "txdb.h"
+#include "txdb-leveldb.h"
 #include "util.h"
 #include "main.h"
 
@@ -64,7 +64,7 @@ void init_blockindex(leveldb::Options& options, bool fRemoveOld = false) {
 }
 
 // CDB subclasses are created and destroyed VERY OFTEN. That's why
-// we shouldn't treat this as a free operations.
+// we shouldn't treat this as free operations.
 CTxDB::CTxDB(const char* pszMode)
 {
     assert(pszMode);
@@ -95,10 +95,10 @@ CTxDB::CTxDB(const char* pszMode)
             printf("Required index version is %d, removing old database\n", DATABASE_VERSION);
 
             // Leveldb instance destruction
-            delete txdb;
-            txdb = pdb = NULL;
             delete activeBatch;
             activeBatch = NULL;
+            delete txdb;
+            txdb = pdb = NULL;
 
             init_blockindex(options, true); // Remove directory and create new database
             pdb = txdb;