mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-11 15:48:05 +00:00
Fix segfault when creating new wallet
The initialization of the default key used keyUser instead of vchDefaultKey. keyUser is now complete removed.
This commit is contained in:
parent
c774b16976
commit
d3800d59d5
@ -962,21 +962,15 @@ bool CWallet::LoadWallet(bool& fFirstRunRet)
|
|||||||
return false;
|
return false;
|
||||||
fFirstRunRet = vchDefaultKey.empty();
|
fFirstRunRet = vchDefaultKey.empty();
|
||||||
|
|
||||||
if (mapKeys.count(vchDefaultKey))
|
if (!mapKeys.count(vchDefaultKey))
|
||||||
{
|
{
|
||||||
// Set keyUser
|
// Create new default key
|
||||||
keyUser.SetPubKey(vchDefaultKey);
|
|
||||||
keyUser.SetPrivKey(mapKeys[vchDefaultKey]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Create new keyUser and set as default key
|
|
||||||
RandAddSeedPerfmon();
|
RandAddSeedPerfmon();
|
||||||
|
|
||||||
vchDefaultKey = GetKeyFromKeyPool();
|
vchDefaultKey = GetKeyFromKeyPool();
|
||||||
if (!SetAddressBookName(PubKeyToAddress(vchDefaultKey), ""))
|
if (!SetAddressBookName(PubKeyToAddress(vchDefaultKey), ""))
|
||||||
return false;
|
return false;
|
||||||
CWalletDB(strWalletFile).WriteDefaultKey(keyUser.GetPubKey());
|
CWalletDB(strWalletFile).WriteDefaultKey(vchDefaultKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateThread(ThreadFlushWalletDB, &strWalletFile);
|
CreateThread(ThreadFlushWalletDB, &strWalletFile);
|
||||||
|
@ -47,7 +47,6 @@ public:
|
|||||||
mutable CCriticalSection cs_mapAddressBook;
|
mutable CCriticalSection cs_mapAddressBook;
|
||||||
|
|
||||||
std::vector<unsigned char> vchDefaultKey;
|
std::vector<unsigned char> vchDefaultKey;
|
||||||
CKey keyUser;
|
|
||||||
|
|
||||||
bool AddKey(const CKey& key);
|
bool AddKey(const CKey& key);
|
||||||
bool AddToWallet(const CWalletTx& wtxIn);
|
bool AddToWallet(const CWalletTx& wtxIn);
|
||||||
|
Loading…
Reference in New Issue
Block a user