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
11 /** CCoinsView backed by the LevelDB coin database (coins/) */
12 class CCoinsViewDB : public CCoinsView
17 CCoinsViewDB(bool fMemory = false);
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);
28 /** Access to the block database (blktree/) */
29 class CBlockTreeDB : public CLevelDB
32 CBlockTreeDB(bool fMemory = false);
34 CBlockTreeDB(const CBlockTreeDB&);
35 void operator=(const CBlockTreeDB&);
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 LoadBlockIndexGuts();
51 #endif // BITCOIN_TXDB_LEVELDB_H