X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fdb.h;h=674d1475d592c1b89ffbd1eb53e10cd51425105c;hb=21d9f36781604e4ca9fc35dc65265593423b73e9;hp=98af4be9a0e0950c4697c9787e734628155b19b4;hpb=d764d9161e548c7fbf835b70eb9d5c75caa28ff5;p=novacoin.git diff --git a/src/db.h b/src/db.h index 98af4be..674d147 100644 --- a/src/db.h +++ b/src/db.h @@ -5,6 +5,8 @@ #ifndef BITCOIN_DB_H #define BITCOIN_DB_H +#include + #include "key.h" #include @@ -13,23 +15,22 @@ #include -class CTxIndex; +class CAccount; +class CAccountingEntry; +class CAddress; +class CBlockLocator; class CDiskBlockIndex; class CDiskTxPos; +class CMasterKey; class COutPoint; -class CAddress; -class CWalletTx; +class CTxIndex; class CWallet; -class CAccount; -class CAccountingEntry; -class CBlockLocator; - +class CWalletTx; extern unsigned int nWalletDBUpdated; extern DbEnv dbenv; - -extern void DBFlush(bool fShutdown, bool fRemoveLogFiles); +extern void DBFlush(bool fShutdown); void ThreadFlushWalletDB(void* parg); bool BackupWallet(const CWallet& wallet, const std::string& strDest); @@ -318,7 +319,7 @@ bool LoadAddresses(); class CKeyPool { public: - int64 nTime; + int64_t nTime; std::vector vchPubKey; CKeyPool() @@ -421,6 +422,19 @@ public: return Write(std::make_pair(std::string("mkey"), nID), kMasterKey, true); } + // Support for BIP 0013 : see https://en.bitcoin.it/wiki/BIP_0013 + bool ReadCScript(const uint160 &hash, CScript& redeemScript) + { + redeemScript.clear(); + return Read(std::make_pair(std::string("cscript"), hash), redeemScript); + } + + bool WriteCScript(const uint160& hash, const CScript& redeemScript) + { + nWalletDBUpdated++; + return Write(std::make_pair(std::string("cscript"), hash), redeemScript, false); + } + bool WriteBestBlock(const CBlockLocator& locator) { nWalletDBUpdated++; @@ -444,18 +458,18 @@ public: return Write(std::string("defaultkey"), vchPubKey); } - bool ReadPool(int64 nPool, CKeyPool& keypool) + bool ReadPool(int64_t nPool, CKeyPool& keypool) { return Read(std::make_pair(std::string("pool"), nPool), keypool); } - bool WritePool(int64 nPool, const CKeyPool& keypool) + bool WritePool(int64_t nPool, const CKeyPool& keypool) { nWalletDBUpdated++; return Write(std::make_pair(std::string("pool"), nPool), keypool); } - bool ErasePool(int64 nPool) + bool ErasePool(int64_t nPool) { nWalletDBUpdated++; return Erase(std::make_pair(std::string("pool"), nPool)); @@ -477,7 +491,7 @@ public: bool ReadAccount(const std::string& strAccount, CAccount& account); bool WriteAccount(const std::string& strAccount, const CAccount& account); bool WriteAccountingEntry(const CAccountingEntry& acentry); - int64 GetAccountCreditDebit(const std::string& strAccount); + int64_t GetAccountCreditDebit(const std::string& strAccount); void ListAccountCreditDebit(const std::string& strAccount, std::list& acentries); int LoadWallet(CWallet* pwallet);