Browse Source

Merge pull request #347 from sipa/delkeyuser

Fix segfault when creating new wallet
pull/1/head
Pieter Wuille 11 years ago
parent
commit
d0d80170a2
  1. 12
      src/wallet.cpp
  2. 1
      src/wallet.h

12
src/wallet.cpp

@ -962,21 +962,15 @@ bool CWallet::LoadWallet(bool& fFirstRunRet) @@ -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);

1
src/wallet.h

@ -47,7 +47,6 @@ public: @@ -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);

Loading…
Cancel
Save