Fix addrProxy setting

Before 0.6 addrProxy was a CAddress, but netbase changed it to CService.
Retain compatibility by wrapping/unwrapping with a CAddress when saving
or loading.

This commit retains compatibility with 0.6.0rc1 (which wrote the setting
as a CService) by trying to parse twice.
This commit is contained in:
Pieter Wuille
2012-02-25 20:59:18 +01:00
parent da9ab62fb7
commit 4a10d4c6dc
2 changed files with 17 additions and 3 deletions

View File

@@ -91,7 +91,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
if (addr.IsValid())
{
addrProxy.SetIP(addr);
walletdb.WriteSetting("addrProxy", addrProxy);
walletdb.WriteSetting("addrProxy", CAddress(addrProxy));
}
else
{
@@ -105,7 +105,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
if (nPort > 0 && nPort < std::numeric_limits<unsigned short>::max())
{
addrProxy.SetPort(nPort);
walletdb.WriteSetting("addrProxy", addrProxy);
walletdb.WriteSetting("addrProxy", CAddress(addrProxy));
}
else
{