// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2011 The Bitcoin developers
+// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_DB_H
#define BITCOIN_DB_H
-#include <stdint.h>
-
#include "key.h"
#include <map>
class CKeyPool
{
public:
- int64_t nTime;
+ int64 nTime;
std::vector<unsigned char> vchPubKey;
CKeyPool()
return Write(std::string("defaultkey"), vchPubKey);
}
- bool ReadPool(int64_t nPool, CKeyPool& keypool)
+ bool ReadPool(int64 nPool, CKeyPool& keypool)
{
return Read(std::make_pair(std::string("pool"), nPool), keypool);
}
- bool WritePool(int64_t nPool, const CKeyPool& keypool)
+ bool WritePool(int64 nPool, const CKeyPool& keypool)
{
nWalletDBUpdated++;
return Write(std::make_pair(std::string("pool"), nPool), keypool);
}
- bool ErasePool(int64_t nPool)
+ bool ErasePool(int64 nPool)
{
nWalletDBUpdated++;
return Erase(std::make_pair(std::string("pool"), nPool));
}
+ // Settings are no longer stored in wallet.dat; these are
+ // used only for backwards compatibility:
template<typename T>
bool ReadSetting(const std::string& strKey, T& value)
{
return Read(std::make_pair(std::string("setting"), strKey), value);
}
-
template<typename T>
bool WriteSetting(const std::string& strKey, const T& value)
{
nWalletDBUpdated++;
return Write(std::make_pair(std::string("setting"), strKey), value);
}
+ bool EraseSetting(const std::string& strKey)
+ {
+ nWalletDBUpdated++;
+ return Erase(std::make_pair(std::string("setting"), strKey));
+ }
+
+ bool WriteMinVersion(int nVersion)
+ {
+ return Write(std::string("minversion"), nVersion);
+ }
bool ReadAccount(const std::string& strAccount, CAccount& account);
bool WriteAccount(const std::string& strAccount, const CAccount& account);
bool WriteAccountingEntry(const CAccountingEntry& acentry);
- int64_t GetAccountCreditDebit(const std::string& strAccount);
+ int64 GetAccountCreditDebit(const std::string& strAccount);
void ListAccountCreditDebit(const std::string& strAccount, std::list<CAccountingEntry>& acentries);
int LoadWallet(CWallet* pwallet);