Make sure that new stake modifier meets fixed generation interval.
[novacoin.git] / src / txdb.h
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2012 The Bitcoin developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef BITCOIN_TXDB_LEVELDB_H
6 #define BITCOIN_TXDB_LEVELDB_H
7
8 #include "main.h"
9 #include "leveldb.h"
10
11 /** CCoinsView backed by the LevelDB coin database (coins/) */
12 class CCoinsViewDB : public CCoinsView
13 {
14 protected:
15     CLevelDB db;
16 public:
17     CCoinsViewDB(bool fMemory = false);
18
19     bool GetCoins(uint256 txid, CCoins &coins);
20     bool SetCoins(uint256 txid, const CCoins &coins);
21     bool HaveCoins(uint256 txid);
22     CBlockIndex *GetBestBlock();
23     bool SetBestBlock(CBlockIndex *pindex);
24     bool BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockIndex *pindex);
25     bool GetStats(CCoinsStats &stats);
26 };
27
28 /** Access to the block database (blktree/) */
29 class CBlockTreeDB : public CLevelDB
30 {
31 public:
32     CBlockTreeDB(bool fMemory = false);
33 private:
34     CBlockTreeDB(const CBlockTreeDB&);
35     void operator=(const CBlockTreeDB&);
36 public:
37     bool WriteBlockIndex(const CDiskBlockIndex& blockindex);
38     bool ReadBestInvalidTrust(CBigNum& bnBestInvalidTrust);
39     bool WriteBestInvalidTrust(CBigNum bnBestInvalidTrust);
40     bool ReadBlockFileInfo(int nFile, CBlockFileInfo &fileinfo);
41     bool WriteBlockFileInfo(int nFile, const CBlockFileInfo &fileinfo);
42     bool ReadLastBlockFile(int &nFile);
43     bool WriteLastBlockFile(int nFile);
44     bool ReadSyncCheckpoint(uint256& hashCheckpoint);
45     bool WriteSyncCheckpoint(uint256 hashCheckpoint);
46     bool ReadCheckpointPubKey(std::string& strPubKey);
47     bool WriteCheckpointPubKey(const std::string& strPubKey);
48     bool ReadModifierUpgradeTime(unsigned int& nUpgradeTime);
49     bool WriteModifierUpgradeTime(const unsigned int& nUpgradeTime);
50     bool LoadBlockIndexGuts();
51 };
52
53 #endif // BITCOIN_TXDB_LEVELDB_H