X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fwalletdb.cpp;h=5590d86f6cd2e918b522e6856a4bc6f8114a6f6c;hb=99a9cc8988dfea35ff6caee2ab2846a47169e8c4;hp=e44885da6816da508c9ee5d16e47d8f3d519a287;hpb=db1eaec482383385156b3e7cb6b2baa9454975f0;p=novacoin.git diff --git a/src/walletdb.cpp b/src/walletdb.cpp index e44885d..5590d86 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -85,7 +85,7 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list> vchSecret; CMalleableKeyView keyView(strKeyView); - if (!pwallet->LoadMalleableKey(keyView, vchSecret)) + if (!pwallet->LoadKey(keyView, vchSecret)) { - strErr = "Error reading wallet database: LoadMalleableKey failed"; + strErr = "Error reading wallet database: LoadKey failed"; return false; } } @@ -326,23 +326,22 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, ssValue >> vchCryptedSecret; CMalleableKeyView keyView(strKeyView); - if (!pwallet->LoadCryptedMalleableKey(keyView, vchCryptedSecret)) + if (!pwallet->LoadCryptedKey(keyView, vchCryptedSecret)) { - strErr = "Error reading wallet database: LoadCryptedMalleableKey failed"; + strErr = "Error reading wallet database: LoadCryptedKey failed"; return false; } } else if (strType == "key" || strType == "wkey") { - vector vchPubKey; - ssKey >> vchPubKey; CKey key; + CPubKey vchPubKey; + ssKey >> vchPubKey; if (strType == "key") { wss.nKeys++; CPrivKey pkey; ssValue >> pkey; - key.SetPubKey(vchPubKey); if (!key.SetPrivKey(pkey)) { strErr = "Error reading wallet database: CPrivKey corrupt"; @@ -353,6 +352,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, strErr = "Error reading wallet database: CPrivKey pubkey inconsistency"; return false; } + key.SetCompressedPubKey(vchPubKey.IsCompressed()); if (!key.IsValid()) { strErr = "Error reading wallet database: invalid CPrivKey"; @@ -363,7 +363,6 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, { CWalletKey wkey; ssValue >> wkey; - key.SetPubKey(vchPubKey); if (!key.SetPrivKey(wkey.vchPrivKey)) { strErr = "Error reading wallet database: CPrivKey corrupt"; @@ -374,6 +373,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, strErr = "Error reading wallet database: CWalletKey pubkey inconsistency"; return false; } + key.SetCompressedPubKey(vchPubKey.IsCompressed()); if (!key.IsValid()) { strErr = "Error reading wallet database: invalid CWalletKey"; @@ -405,7 +405,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, else if (strType == "ckey") { wss.nCKeys++; - vector vchPubKey; + CPubKey vchPubKey; ssKey >> vchPubKey; vector vchPrivKey; ssValue >> vchPrivKey; @@ -525,7 +525,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet) return DB_CORRUPT; } - while (true) + for ( ; ; ) { // Read next record CDataStream ssKey(SER_DISK, CLIENT_VERSION); @@ -625,7 +625,7 @@ DBErrors CWalletDB::FindWalletTx(CWallet* pwallet, vector& vTxHash) return DB_CORRUPT; } - while (true) + for ( ; ; ) { // Read next record CDataStream ssKey(SER_DISK, CLIENT_VERSION); @@ -650,7 +650,7 @@ DBErrors CWalletDB::FindWalletTx(CWallet* pwallet, vector& vTxHash) } pcursor->close(); } - catch (boost::thread_interrupted) { + catch (const boost::thread_interrupted&) { throw; } catch (...) { @@ -758,20 +758,20 @@ bool BackupWallet(const CWallet& wallet, const string& strDest) bitdb.mapFileUseCount.erase(wallet.strWalletFile); // Copy wallet.dat - filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile; - filesystem::path pathDest(strDest); - if (filesystem::is_directory(pathDest)) + boost::filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile; + boost::filesystem::path pathDest(strDest); + if (boost::filesystem::is_directory(pathDest)) pathDest /= wallet.strWalletFile; try { #if BOOST_VERSION >= 104000 - filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists); + boost::filesystem::copy_file(pathSrc, pathDest, boost::filesystem::copy_option::overwrite_if_exists); #else - filesystem::copy_file(pathSrc, pathDest); + boost::filesystem::copy_file(pathSrc, pathDest); #endif printf("copied wallet.dat to %s\n", pathDest.string().c_str()); return true; - } catch(const filesystem::filesystem_error &e) { + } catch(const boost::filesystem::filesystem_error &e) { printf("error copying wallet.dat to %s - %s\n", pathDest.string().c_str(), e.what()); return false; } @@ -940,7 +940,7 @@ bool ImportWallet(CWallet *pwallet, const string& strLocation) } printf("Importing %s...\n", addr.ToString().c_str()); - if (!pwallet->AddMalleableKey(mKey)) { + if (!pwallet->AddKey(mKey)) { fGood = false; continue; }