X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwalletdb.cpp;h=5c78ff2d2c5abeac14f556b846d0645ccb3a679f;hb=75744e6526193604bfbcc6be3a3793315556f12c;hp=2fe59ce54b911bda8d8af6250d7d0e757efefff9;hpb=edc83f6417f70f35539776cce6cdceb9d896a41b;p=novacoin.git diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 2fe59ce..5c78ff2 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -304,31 +304,31 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, } else if (strType == "malpair") { - string strKey, strKeyView; + string strKeyView; CSecret vchSecret; - CMalleableKeyView keyView; - ssKey >> strKeyView; - keyView.SetString(strKeyView); ssValue >> vchSecret; - CMalleableKey mKey = keyView.GetMalleableKey(vchSecret); - - if (mKey.IsNull()) - { - strErr = "Error reading wallet database: CMalleableKey is corrupt"; - return false; - } - if (mKey.GetID() != keyView.GetID()) + CMalleableKeyView keyView(strKeyView); + if (!pwallet->LoadMalleableKey(keyView, vchSecret)) { - strErr = "Error reading wallet database: CMalleableKey view inconsistency"; + strErr = "Error reading wallet database: LoadMalleableKey failed"; return false; } + } + else if (strType == "malcpair") + { + string strKeyView; - if (!pwallet->LoadMalleableKey(mKey)) + std::vector vchCryptedSecret; + ssKey >> strKeyView; + ssValue >> vchCryptedSecret; + + CMalleableKeyView keyView(strKeyView); + if (!pwallet->LoadCryptedMalleableKey(keyView, vchCryptedSecret)) { - strErr = "Error reading wallet database: LoadMalleableKey failed"; + strErr = "Error reading wallet database: LoadCryptedMalleableKey failed"; return false; } } @@ -497,7 +497,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, static bool IsKeyType(string strType) { return (strType== "key" || strType == "wkey" || - strType == "mkey" || strType == "ckey" || strType == "malpair"); + strType == "mkey" || strType == "ckey" || strType == "malpair" || strType == "malcpair"); } DBErrors CWalletDB::LoadWallet(CWallet* pwallet) @@ -879,7 +879,8 @@ bool ImportWallet(CWallet *pwallet, const string& strLocation) continue; std::vector vstr; - boost::split(vstr, line, boost::is_any_of(" ")); + istringstream iss(line); + copy(istream_iterator(iss), istream_iterator(), back_inserter(vstr)); if (vstr.size() < 2) continue; CBitcoinSecret vchSecret;