X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fdb.h;h=1ac971d538760c8032e2d1c2318c44df01476d18;hb=2e4d3252d0398df2535befcd0176ae00e360e3a1;hp=9a8af315641345181bbf220867e4331777fea191;hpb=05f0aaf76e6da88f32b3b7c80d22c830396aa8bb;p=novacoin.git diff --git a/src/db.h b/src/db.h index 9a8af31..1ac971d 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; @@ -37,7 +35,6 @@ private: bool fDbEnvInit; bool fMockDb; boost::filesystem::path pathEnv; - std::string strPath; void EnvShutdown(); @@ -312,6 +309,54 @@ public: }; + + + + + +/** Access to the transaction database (coins.dat) */ +class CCoinsDB : public CDB +{ +public: + CCoinsDB(const char* pszMode="r+") : CDB("coins.dat", pszMode) { } +private: + CCoinsDB(const CCoinsDB&); + void operator=(const CCoinsDB&); +public: + 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 ReadBestInvalidTrust(CBigNum& bnBestInvalidTrust); + bool WriteBestInvalidTrust(CBigNum bnBestInvalidTrust); + bool ReadBlockFileInfo(int nFile, CBlockFileInfo &fileinfo); + bool WriteBlockFileInfo(int nFile, const CBlockFileInfo &fileinfo); + bool ReadLastBlockFile(int &nFile); + bool WriteLastBlockFile(int nFile); + bool ReadSyncCheckpoint(uint256& hashCheckpoint); + bool WriteSyncCheckpoint(uint256 hashCheckpoint); + bool ReadCheckpointPubKey(std::string& strPubKey); + bool WriteCheckpointPubKey(const std::string& strPubKey); + bool LoadBlockIndexGuts(); +}; + + +bool LoadBlockIndex(CCoinsDB &coinsdb, CChainDB &chaindb); + + /** Access to the (IP) address database (peers.dat) */ class CAddrDB {