changeset 705:1eaf93557fe5 draft

Merge pull request #347 from sipa/delkeyuser Fix segfault when creating new wallet
author Pieter Wuille <pieter.wuille@gmail.com>
date Sun, 26 Jun 2011 03:04:39 -0700
parents 0213b284ff93 (current diff) 250aa8b40a14 (diff)
children 65d3b325c5eb 432f62308af4 da0eb2508feb 8b78dad87aa5 099957ac6246
files
diffstat 2 files changed, 3 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -962,21 +962,15 @@
         return false;
     fFirstRunRet = vchDefaultKey.empty();
 
-    if (mapKeys.count(vchDefaultKey))
+    if (!mapKeys.count(vchDefaultKey))
     {
-        // Set keyUser
-        keyUser.SetPubKey(vchDefaultKey);
-        keyUser.SetPrivKey(mapKeys[vchDefaultKey]);
-    }
-    else
-    {
-        // Create new keyUser and set as default key
+        // Create new default key
         RandAddSeedPerfmon();
 
         vchDefaultKey = GetKeyFromKeyPool();
         if (!SetAddressBookName(PubKeyToAddress(vchDefaultKey), ""))
             return false;
-        CWalletDB(strWalletFile).WriteDefaultKey(keyUser.GetPubKey());
+        CWalletDB(strWalletFile).WriteDefaultKey(vchDefaultKey);
     }
 
     CreateThread(ThreadFlushWalletDB, &strWalletFile);
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -47,7 +47,6 @@
     mutable CCriticalSection cs_mapAddressBook;
 
     std::vector<unsigned char> vchDefaultKey;
-    CKey keyUser;
 
     bool AddKey(const CKey& key);
     bool AddToWallet(const CWalletTx& wtxIn);