X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwalletdb.cpp;h=a072f18783d872a5154c351802022e26ad7744e0;hb=5f3f7465db4444e49dd4a896f88c090b40d0a303;hp=a7529d18d8f8099a6d26adb9039ccbff8eb468c6;hpb=30785656536625e26b09b6b6dbcb4c062ba10cc1;p=novacoin.git diff --git a/src/walletdb.cpp b/src/walletdb.cpp index a7529d1..a072f18 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)