5 #ifndef BITCOIN_WALLETDB_H
6 #define BITCOIN_WALLETDB_H
30 CWalletDB(std::string strFilename,
const char* pszMode=
"r+") :
CDB(strFilename.c_str(), pszMode)
37 bool WriteName(
const std::string& strAddress,
const std::string& strName);
39 bool EraseName(
const std::string& strAddress);
44 return Write(std::make_pair(std::string(
"tx"), hash), wtx);
50 return Erase(std::make_pair(std::string(
"tx"), hash));
56 return Write(std::make_pair(std::string(
"key"), vchPubKey), vchPrivKey,
false);
59 bool WriteCryptedKey(
const CPubKey& vchPubKey,
const std::vector<unsigned char>& vchCryptedSecret,
bool fEraseUnencryptedKey =
true)
62 if (!
Write(std::make_pair(std::string(
"ckey"), vchPubKey), vchCryptedSecret,
false))
64 if (fEraseUnencryptedKey)
66 Erase(std::make_pair(std::string(
"key"), vchPubKey));
67 Erase(std::make_pair(std::string(
"wkey"), vchPubKey));
75 return Write(std::make_pair(std::string(
"mkey"), nID), kMasterKey,
true);
81 return Write(std::make_pair(std::string(
"cscript"), hash), redeemScript,
false);
87 return Write(std::string(
"bestblock"), locator);
92 return Read(std::string(
"bestblock"), locator);
98 return Write(std::string(
"orderposnext"), nOrderPosNext);
104 return Write(std::string(
"defaultkey"), vchPubKey);
109 return Read(std::make_pair(std::string(
"pool"), nPool), keypool);
115 return Write(std::make_pair(std::string(
"pool"), nPool), keypool);
121 return Erase(std::make_pair(std::string(
"pool"), nPool));
129 return Read(std::make_pair(std::string(
"setting"), strKey), value);
135 return Write(std::make_pair(std::string(
"setting"), strKey), value);
140 return Erase(std::make_pair(std::string(
"setting"), strKey));
145 return Write(std::string(
"minversion"), nVersion);
159 static bool Recover(
CDBEnv& dbenv, std::string filename,
bool fOnlyKeys);
163 #endif // BITCOIN_WALLETDB_H
unsigned int nWalletDBUpdated
bool WriteMinVersion(int nVersion)
bool WriteKey(const CPubKey &vchPubKey, const CPrivKey &vchPrivKey)
int64 GetAccountCreditDebit(const std::string &strAccount)
bool WriteAccount(const std::string &strAccount, const CAccount &account)
CWalletDB(std::string strFilename, const char *pszMode="r+")
bool WriteMasterKey(unsigned int nID, const CMasterKey &kMasterKey)
Master key for wallet encryption.
bool Write(const K &key, const T &value, bool fOverwrite=true)
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
bool WriteSetting(const std::string &strKey, const T &value)
bool ReadPool(int64 nPool, CKeyPool &keypool)
void ListAccountCreditDebit(const std::string &strAccount, std::list< CAccountingEntry > &acentries)
unsigned long long uint64
DBErrors
Error statuses for the wallet database.
void operator=(const CWalletDB &)
bool EraseTx(uint256 hash)
std::vector< unsigned char, secure_allocator< unsigned char > > CPrivKey
bool WriteAccountingEntry(const uint64 nAccEntryNum, const CAccountingEntry &acentry)
bool WriteName(const std::string &strAddress, const std::string &strName)
DBErrors LoadWallet(CWallet *pwallet)
bool WritePool(int64 nPool, const CKeyPool &keypool)
An encapsulated public key.
RAII class that provides access to a Berkeley database.
bool EraseSetting(const std::string &strKey)
bool WriteTx(uint256 hash, const CWalletTx &wtx)
Access to the wallet database (wallet.dat)
bool Read(const K &key, T &value)
A transaction with a bunch of additional info that only the owner cares about.
DBErrors ReorderTransactions(CWallet *)
bool ReadBestBlock(CBlockLocator &locator)
bool WriteDefaultKey(const CPubKey &vchPubKey)
bool WriteBestBlock(const CBlockLocator &locator)
bool WriteCryptedKey(const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret, bool fEraseUnencryptedKey=true)
Serialized script, used inside transaction inputs and outputs.
bool WriteOrderPosNext(int64 nOrderPosNext)
static bool Recover(CDBEnv &dbenv, std::string filename, bool fOnlyKeys)
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
bool ReadSetting(const std::string &strKey, T &value)
bool EraseName(const std::string &strAddress)
bool WriteCScript(const uint160 &hash, const CScript &redeemScript)
bool ErasePool(int64 nPool)
bool ReadAccount(const std::string &strAccount, CAccount &account)