aboutsummaryrefslogtreecommitdiff
path: root/src/db.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/db.h')
-rw-r--r--src/db.h40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/db.h b/src/db.h
index 61b59060a0..dd8993d56d 100644
--- a/src/db.h
+++ b/src/db.h
@@ -17,10 +17,8 @@ class CAddress;
class CAddrMan;
class CBlockLocator;
class CDiskBlockIndex;
-class CDiskTxPos;
class CMasterKey;
class COutPoint;
-class CTxIndex;
class CWallet;
class CWalletTx;
@@ -316,39 +314,43 @@ public:
-/** Access to the transaction database (blkindex.dat) */
-class CTxDB : public CDB
+/** Access to the transaction database (coins.dat) */
+class CCoinsDB : public CDB
{
public:
- CTxDB(const char* pszMode="r+") : CDB("blkindex.dat", pszMode) { }
+ CCoinsDB(const char* pszMode="r+") : CDB("coins.dat", pszMode) { }
private:
- CTxDB(const CTxDB&);
- void operator=(const CTxDB&);
+ CCoinsDB(const CCoinsDB&);
+ void operator=(const CCoinsDB&);
public:
- bool ReadTxIndex(uint256 hash, CTxIndex& txindex);
- bool UpdateTxIndex(uint256 hash, const CTxIndex& txindex);
- bool AddTxIndex(const CTransaction& tx, const CDiskTxPos& pos, int nHeight);
- bool EraseTxIndex(const CTransaction& tx);
- bool ContainsTx(uint256 hash);
- bool ReadDiskTx(uint256 hash, CTransaction& tx, CTxIndex& txindex);
- bool ReadDiskTx(uint256 hash, CTransaction& tx);
- bool ReadDiskTx(COutPoint outpoint, CTransaction& tx, CTxIndex& txindex);
- bool ReadDiskTx(COutPoint outpoint, CTransaction& tx);
- bool WriteBlockIndex(const CDiskBlockIndex& blockindex);
+ bool ReadCoins(uint256 hash, CCoins &coins);
+ bool WriteCoins(uint256 hash, const CCoins& coins);
+ bool HaveCoins(uint256 hash);
bool ReadHashBestChain(uint256& hashBestChain);
bool WriteHashBestChain(uint256 hashBestChain);
+};
+
+/** Access to the block database (chain.dat) */
+class CChainDB : public CDB
+{
+public:
+ CChainDB(const char* pszMode="r+") : CDB("chain.dat", pszMode) { }
+private:
+ CChainDB(const CChainDB&);
+ void operator=(const CChainDB&);
+public:
+ bool WriteBlockIndex(const CDiskBlockIndex& blockindex);
bool ReadBestInvalidWork(CBigNum& bnBestInvalidWork);
bool WriteBestInvalidWork(CBigNum bnBestInvalidWork);
bool ReadBlockFileInfo(int nFile, CBlockFileInfo &fileinfo);
bool WriteBlockFileInfo(int nFile, const CBlockFileInfo &fileinfo);
bool ReadLastBlockFile(int &nFile);
bool WriteLastBlockFile(int nFile);
- bool LoadBlockIndex();
-private:
bool LoadBlockIndexGuts();
};
+bool LoadBlockIndex(CCoinsDB &coinsdb, CChainDB &chaindb);
/** Access to the (IP) address database (peers.dat) */