X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwalletdb.cpp;h=5c78ff2d2c5abeac14f556b846d0645ccb3a679f;hb=75744e6526193604bfbcc6be3a3793315556f12c;hp=a7529d18d8f8099a6d26adb9039ccbff8eb468c6;hpb=30785656536625e26b09b6b6dbcb4c062ba10cc1;p=novacoin.git diff --git a/src/walletdb.cpp b/src/walletdb.cpp index a7529d1..5c78ff2 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -5,6 +5,7 @@ #include "walletdb.h" #include "wallet.h" +#include "base58.h" #include #include @@ -219,6 +220,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, // Taking advantage of the fact that pair serialization // is just the two items serialized one after the other ssKey >> strType; + if (strType == "name") { string strAddress; @@ -300,6 +302,36 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, // so set the wallet birthday to the beginning of time. pwallet->nTimeFirstKey = 1; } + else if (strType == "malpair") + { + string strKeyView; + + CSecret vchSecret; + ssKey >> strKeyView; + ssValue >> vchSecret; + + CMalleableKeyView keyView(strKeyView); + if (!pwallet->LoadMalleableKey(keyView, vchSecret)) + { + strErr = "Error reading wallet database: LoadMalleableKey failed"; + return false; + } + } + else if (strType == "malcpair") + { + string strKeyView; + + std::vector vchCryptedSecret; + ssKey >> strKeyView; + ssValue >> vchCryptedSecret; + + CMalleableKeyView keyView(strKeyView); + if (!pwallet->LoadCryptedMalleableKey(keyView, vchCryptedSecret)) + { + strErr = "Error reading wallet database: LoadCryptedMalleableKey failed"; + return false; + } + } else if (strType == "key" || strType == "wkey") { vector vchPubKey; @@ -384,6 +416,20 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, } wss.fIsEncrypted = true; } + else if (strType == "malmeta") + { + string strKeyView; + ssKey >> strKeyView; + + CMalleableKeyView keyView; + keyView.SetString(strKeyView); + + CKeyMetadata keyMeta; + ssValue >> keyMeta; + wss.nKeyMeta++; + + pwallet->LoadMalleableKeyMetadata(keyView, keyMeta); + } else if (strType == "keymeta") { CPubKey vchPubKey; @@ -451,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 == "mkey" || strType == "ckey" || strType == "malpair" || strType == "malcpair"); } DBErrors CWalletDB::LoadWallet(CWallet* pwallet) @@ -833,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;