From 4a10d4c6dcd04eb2496257754782150793ce53b1 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 25 Feb 2012 20:59:18 +0100 Subject: 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. --- src/db.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/db.cpp') diff --git a/src/db.cpp b/src/db.cpp index ea6d46a6e5..4d4a3c4696 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -931,7 +931,21 @@ int CWalletDB::LoadWallet(CWallet* pwallet) if (strKey == "fMinimizeToTray") ssValue >> fMinimizeToTray; if (strKey == "fMinimizeOnClose") ssValue >> fMinimizeOnClose; if (strKey == "fUseProxy") ssValue >> fUseProxy; - if (strKey == "addrProxy") ssValue >> addrProxy; + if (strKey == "addrProxy") + { + CAddress addr; + CDataStream ssValue2 = ssValue; + // 0.6.0rc1 saved this as a CService, which causes failure when parsing as a CAddress + try + { + ssValue >> addr; + addrProxy = addr; + } + catch (std::ios_base::failure &e) + { + ssValue2 >> addrProxy; + } + } if (fHaveUPnP && strKey == "fUseUPnP") ssValue >> fUseUPnP; } else if (strType == "minversion") -- cgit v1.2.3