Skip to content

Commit b19bcb7

Browse files
committed
Merge pull request #3638
cdb6c16 remove setting methods in wallet/walletdb (Cozz Lovan) 44eb59e [Qt] remove broken OptionsModel::Upgrade() (Cozz Lovan)
2 parents 0514fb3 + cdb6c16 commit b19bcb7

File tree

6 files changed

+0
-110
lines changed

6 files changed

+0
-110
lines changed

src/qt/bitcoin.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,6 @@ void BitcoinApplication::initializeResult(int retval)
376376
returnValue = retval ? 0 : 1;
377377
if(retval)
378378
{
379-
// Miscellaneous initialization after core is initialized
380-
optionsModel->Upgrade(); // Must be done after AppInit2
381-
382379
#ifdef ENABLE_WALLET
383380
PaymentServer::LoadRootCAs();
384381
paymentServer->setOptionsModel(optionsModel);

src/qt/optionsmodel.cpp

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -130,69 +130,6 @@ void OptionsModel::Reset()
130130
// default setting for OptionsModel::StartAtStartup - disabled
131131
if (GUIUtil::GetStartOnSystemStartup())
132132
GUIUtil::SetStartOnSystemStartup(false);
133-
134-
// Ensure Upgrade() is not running again by setting the bImportFinished flag
135-
settings.setValue("bImportFinished", true);
136-
}
137-
138-
void OptionsModel::Upgrade()
139-
{
140-
QSettings settings;
141-
142-
// Already upgraded
143-
if (settings.contains("bImportFinished"))
144-
return;
145-
146-
settings.setValue("bImportFinished", true);
147-
148-
#ifdef ENABLE_WALLET
149-
// Move settings from old wallet.dat (if any):
150-
CWalletDB walletdb(strWalletFile);
151-
152-
QList<QString> intOptions;
153-
intOptions << "nDisplayUnit" << "nTransactionFee";
154-
foreach(QString key, intOptions)
155-
{
156-
int value = 0;
157-
if (walletdb.ReadSetting(key.toStdString(), value))
158-
{
159-
settings.setValue(key, value);
160-
walletdb.EraseSetting(key.toStdString());
161-
}
162-
}
163-
QList<QString> boolOptions;
164-
boolOptions << "bDisplayAddresses" << "fMinimizeToTray" << "fMinimizeOnClose" << "fUseProxy" << "fUseUPnP";
165-
foreach(QString key, boolOptions)
166-
{
167-
bool value = false;
168-
if (walletdb.ReadSetting(key.toStdString(), value))
169-
{
170-
settings.setValue(key, value);
171-
walletdb.EraseSetting(key.toStdString());
172-
}
173-
}
174-
try
175-
{
176-
CAddress addrProxyAddress;
177-
if (walletdb.ReadSetting("addrProxy", addrProxyAddress))
178-
{
179-
settings.setValue("addrProxy", addrProxyAddress.ToStringIPPort().c_str());
180-
walletdb.EraseSetting("addrProxy");
181-
}
182-
}
183-
catch (std::ios_base::failure &e)
184-
{
185-
// 0.6.0rc1 saved this as a CService, which causes failure when parsing as a CAddress
186-
CService addrProxy;
187-
if (walletdb.ReadSetting("addrProxy", addrProxy))
188-
{
189-
settings.setValue("addrProxy", addrProxy.ToStringIPPort().c_str());
190-
walletdb.EraseSetting("addrProxy");
191-
}
192-
}
193-
#endif
194-
195-
Init();
196133
}
197134

198135
int OptionsModel::rowCount(const QModelIndex & parent) const

src/qt/optionsmodel.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ class OptionsModel : public QAbstractListModel
4646
void Init();
4747
void Reset();
4848

49-
/* Migrate settings from wallet.dat after app initialization */
50-
void Upgrade();
51-
5249
int rowCount(const QModelIndex & parent = QModelIndex()) const;
5350
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
5451
bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);

src/wallet.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,6 @@ void CWallet::SetBestChain(const CBlockLocator& loc)
191191
walletdb.WriteBestBlock(loc);
192192
}
193193

194-
// This class implements an addrIncoming entry that causes pre-0.4
195-
// clients to crash on startup if reading a private-key-encrypted wallet.
196-
class CCorruptAddress
197-
{
198-
public:
199-
IMPLEMENT_SERIALIZE
200-
(
201-
if (nType & SER_DISK)
202-
READWRITE(nVersion);
203-
)
204-
};
205-
206194
bool CWallet::SetMinVersion(enum WalletFeature nVersion, CWalletDB* pwalletdbIn, bool fExplicit)
207195
{
208196
AssertLockHeld(cs_wallet); // nWalletVersion
@@ -221,13 +209,6 @@ bool CWallet::SetMinVersion(enum WalletFeature nVersion, CWalletDB* pwalletdbIn,
221209
if (fFileBacked)
222210
{
223211
CWalletDB* pwalletdb = pwalletdbIn ? pwalletdbIn : new CWalletDB(strWalletFile);
224-
if (nWalletVersion >= 40000)
225-
{
226-
// Versions prior to 0.4.0 did not support the "minversion" record.
227-
// Use a CCorruptAddress to make them crash instead.
228-
CCorruptAddress corruptAddress;
229-
pwalletdb->WriteSetting("addrIncoming", corruptAddress);
230-
}
231212
if (nWalletVersion > 40000)
232213
pwalletdb->WriteMinVersion(nWalletVersion);
233214
if (!pwalletdbIn)

src/walletdb.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,6 @@ bool CWalletDB::ErasePool(int64_t nPool)
154154
return Erase(std::make_pair(std::string("pool"), nPool));
155155
}
156156

157-
bool CWalletDB::EraseSetting(const std::string& strKey)
158-
{
159-
nWalletDBUpdated++;
160-
return Erase(std::make_pair(std::string("setting"), strKey));
161-
}
162-
163157
bool CWalletDB::WriteMinVersion(int nVersion)
164158
{
165159
return Write(std::string("minversion"), nVersion);

src/walletdb.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,6 @@ class CWalletDB : public CDB
104104
bool WritePool(int64_t nPool, const CKeyPool& keypool);
105105
bool ErasePool(int64_t nPool);
106106

107-
// Settings are no longer stored in wallet.dat; these are
108-
// used only for backwards compatibility:
109-
template<typename T>
110-
bool ReadSetting(const std::string& strKey, T& value)
111-
{
112-
return Read(std::make_pair(std::string("setting"), strKey), value);
113-
}
114-
template<typename T>
115-
bool WriteSetting(const std::string& strKey, const T& value)
116-
{
117-
nWalletDBUpdated++;
118-
return Write(std::make_pair(std::string("setting"), strKey), value);
119-
}
120-
121-
bool EraseSetting(const std::string& strKey);
122-
123107
bool WriteMinVersion(int nVersion);
124108

125109
bool ReadAccount(const std::string& strAccount, CAccount& account);

0 commit comments

Comments
 (0)