Browse Source

remove setting methods in wallet/walletdb

0.10
Cozz Lovan 11 years ago
parent
commit
cdb6c16935
  1. 19
      src/wallet.cpp
  2. 6
      src/walletdb.cpp
  3. 16
      src/walletdb.h

19
src/wallet.cpp

@ -191,18 +191,6 @@ void CWallet::SetBestChain(const CBlockLocator& loc)
walletdb.WriteBestBlock(loc); walletdb.WriteBestBlock(loc);
} }
// This class implements an addrIncoming entry that causes pre-0.4
// clients to crash on startup if reading a private-key-encrypted wallet.
class CCorruptAddress
{
public:
IMPLEMENT_SERIALIZE
(
if (nType & SER_DISK)
READWRITE(nVersion);
)
};
bool CWallet::SetMinVersion(enum WalletFeature nVersion, CWalletDB* pwalletdbIn, bool fExplicit) bool CWallet::SetMinVersion(enum WalletFeature nVersion, CWalletDB* pwalletdbIn, bool fExplicit)
{ {
AssertLockHeld(cs_wallet); // nWalletVersion AssertLockHeld(cs_wallet); // nWalletVersion
@ -221,13 +209,6 @@ bool CWallet::SetMinVersion(enum WalletFeature nVersion, CWalletDB* pwalletdbIn,
if (fFileBacked) if (fFileBacked)
{ {
CWalletDB* pwalletdb = pwalletdbIn ? pwalletdbIn : new CWalletDB(strWalletFile); CWalletDB* pwalletdb = pwalletdbIn ? pwalletdbIn : new CWalletDB(strWalletFile);
if (nWalletVersion >= 40000)
{
// Versions prior to 0.4.0 did not support the "minversion" record.
// Use a CCorruptAddress to make them crash instead.
CCorruptAddress corruptAddress;
pwalletdb->WriteSetting("addrIncoming", corruptAddress);
}
if (nWalletVersion > 40000) if (nWalletVersion > 40000)
pwalletdb->WriteMinVersion(nWalletVersion); pwalletdb->WriteMinVersion(nWalletVersion);
if (!pwalletdbIn) if (!pwalletdbIn)

6
src/walletdb.cpp

@ -154,12 +154,6 @@ bool CWalletDB::ErasePool(int64_t nPool)
return Erase(std::make_pair(std::string("pool"), nPool)); return Erase(std::make_pair(std::string("pool"), nPool));
} }
bool CWalletDB::EraseSetting(const std::string& strKey)
{
nWalletDBUpdated++;
return Erase(std::make_pair(std::string("setting"), strKey));
}
bool CWalletDB::WriteMinVersion(int nVersion) bool CWalletDB::WriteMinVersion(int nVersion)
{ {
return Write(std::string("minversion"), nVersion); return Write(std::string("minversion"), nVersion);

16
src/walletdb.h

@ -104,22 +104,6 @@ public:
bool WritePool(int64_t nPool, const CKeyPool& keypool); bool WritePool(int64_t nPool, const CKeyPool& keypool);
bool ErasePool(int64_t nPool); bool ErasePool(int64_t 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);
bool WriteMinVersion(int nVersion); bool WriteMinVersion(int nVersion);
bool ReadAccount(const std::string& strAccount, CAccount& account); bool ReadAccount(const std::string& strAccount, CAccount& account);

Loading…
Cancel
Save