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 license.txt or http://www.opensource.org/licenses/mit-license.php.
6 #ifndef BITCOIN_TXDB_BDB_H
7 #define BITCOIN_TXDB_BDB_H
10 /** Access to the transaction database (blkindex.dat) */
11 class CTxDB : public CDB
14 CTxDB(const char* pszMode="r+") : CDB("blkindex.dat", pszMode) { }
17 void operator=(const CTxDB&);
19 bool ReadTxIndex(uint256 hash, CTxIndex& txindex);
20 bool UpdateTxIndex(uint256 hash, const CTxIndex& txindex);
21 bool AddTxIndex(const CTransaction& tx, const CDiskTxPos& pos, int nHeight);
22 bool EraseTxIndex(const CTransaction& tx);
23 bool ContainsTx(uint256 hash);
24 bool ReadDiskTx(uint256 hash, CTransaction& tx, CTxIndex& txindex);
25 bool ReadDiskTx(uint256 hash, CTransaction& tx);
26 bool ReadDiskTx(COutPoint outpoint, CTransaction& tx, CTxIndex& txindex);
27 bool ReadDiskTx(COutPoint outpoint, CTransaction& tx);
28 bool WriteBlockIndex(const CDiskBlockIndex& blockindex);
29 bool ReadHashBestChain(uint256& hashBestChain);
30 bool WriteHashBestChain(uint256 hashBestChain);
31 bool ReadBestInvalidTrust(CBigNum& bnBestInvalidTrust);
32 bool WriteBestInvalidTrust(CBigNum bnBestInvalidTrust);
33 bool ReadSyncCheckpoint(uint256& hashCheckpoint);
34 bool WriteSyncCheckpoint(uint256 hashCheckpoint);
35 bool ReadCheckpointPubKey(std::string& strPubKey);
36 bool WriteCheckpointPubKey(const std::string& strPubKey);
37 bool LoadBlockIndex();
39 bool LoadBlockIndexGuts();