Merge pull request #5604 from nuttycom/fix_missing_wallet_lock

GenerateNewKey must be guarded by a cs_wallet lock
This commit is contained in:
Kris Nuttycombe 2022-02-27 09:20:44 -07:00 committed by GitHub
commit 18f443db1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -5719,6 +5719,8 @@ bool CWallet::InitLoadWallet(const CChainParams& params, bool clearWitnessCaches
{
// Create new keyUser and set as default key
if (!walletInstance->IsCrypted()) {
LOCK(walletInstance->cs_wallet);
CPubKey newDefaultKey = walletInstance->GenerateNewKey(true);
walletInstance->SetDefaultKey(newDefaultKey);
if (!walletInstance->SetAddressBook(walletInstance->vchDefaultKey.GetID(), "", "receive"))