GenerateNewKey must be guarded by a cs_wallet lock
This commit is contained in:
parent
7d9dda4b7e
commit
399ffa7f5c
|
@ -5719,6 +5719,8 @@ bool CWallet::InitLoadWallet(const CChainParams& params, bool clearWitnessCaches
|
||||||
{
|
{
|
||||||
// Create new keyUser and set as default key
|
// Create new keyUser and set as default key
|
||||||
if (!walletInstance->IsCrypted()) {
|
if (!walletInstance->IsCrypted()) {
|
||||||
|
LOCK(walletInstance->cs_wallet);
|
||||||
|
|
||||||
CPubKey newDefaultKey = walletInstance->GenerateNewKey(true);
|
CPubKey newDefaultKey = walletInstance->GenerateNewKey(true);
|
||||||
walletInstance->SetDefaultKey(newDefaultKey);
|
walletInstance->SetDefaultKey(newDefaultKey);
|
||||||
if (!walletInstance->SetAddressBook(walletInstance->vchDefaultKey.GetID(), "", "receive"))
|
if (!walletInstance->SetAddressBook(walletInstance->vchDefaultKey.GetID(), "", "receive"))
|
||||||
|
|
Loading…
Reference in New Issue