aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2011-06-26 03:04:39 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2011-06-26 03:04:39 -0700
commitd0d80170a2ca73004e08fb85007fe055cbf4e411 (patch)
tree6a106e5badc30d610bb643e40080232270f6b063 /src
parentc774b1697690c3f94ccd79c5de660b6050ac6409 (diff)
parentd3800d59d557388b813513ef16f6b840467821d4 (diff)
Merge pull request #347 from sipa/delkeyuser
Fix segfault when creating new wallet
Diffstat (limited to 'src')
-rw-r--r--src/wallet.cpp12
-rw-r--r--src/wallet.h1
2 files changed, 3 insertions, 10 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index b06187a4b2..e35bce61ef 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -962,21 +962,15 @@ bool CWallet::LoadWallet(bool& fFirstRunRet)
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);
diff --git a/src/wallet.h b/src/wallet.h
index cda4293bd2..b069d31ce9 100644
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -47,7 +47,6 @@ public:
mutable CCriticalSection cs_mapAddressBook;
std::vector<unsigned char> vchDefaultKey;
- CKey keyUser;
bool AddKey(const CKey& key);
bool AddToWallet(const CWalletTx& wtxIn);