Obsolete keypool and make sure database removes log files on shutdown.
[novacoin.git] / src / db.h
index a86c110..98af4be 100644 (file)
--- a/src/db.h
+++ b/src/db.h
@@ -1,4 +1,5 @@
 // Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2011 The Bitcoin developers
 // Distributed under the MIT/X11 software license, see the accompanying
 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
 #ifndef BITCOIN_DB_H
@@ -28,13 +29,12 @@ extern unsigned int nWalletDBUpdated;
 extern DbEnv dbenv;
 
 
-extern void DBFlush(bool fShutdown);
+extern void DBFlush(bool fShutdown, bool fRemoveLogFiles);
 void ThreadFlushWalletDB(void* parg);
 bool BackupWallet(const CWallet& wallet, const std::string& strDest);
 
 
 
-
 class CDB
 {
 protected:
@@ -88,7 +88,7 @@ protected:
         if (!pdb)
             return false;
         if (fReadOnly)
-            assert(("Write called on database in read-only mode", false));
+            assert(!"Write called on database in read-only mode");
 
         // Key
         CDataStream ssKey(SER_DISK);
@@ -117,7 +117,7 @@ protected:
         if (!pdb)
             return false;
         if (fReadOnly)
-            assert(("Erase called on database in read-only mode", false));
+            assert(!"Erase called on database in read-only mode");
 
         // Key
         CDataStream ssKey(SER_DISK);
@@ -256,6 +256,8 @@ public:
     {
         return Write(std::string("version"), nVersion);
     }
+
+    bool static Rewrite(const std::string& strFile, const char* pszSkip = NULL);
 };
 
 
@@ -346,7 +348,9 @@ enum DBErrors
 {
     DB_LOAD_OK,
     DB_CORRUPT,
-    DB_TOO_NEW
+    DB_TOO_NEW,
+    DB_LOAD_FAIL,
+    DB_NEED_REWRITE
 };
 
 class CWalletDB : public CDB