wallet: Correctly log stats for encrypted messages.

Previously creating an encrypted wallet would result in the keypool size
incorrectly being reported as 0.

See: https://github.com/bitcoin/bitcoin/pull/32636#discussion_r2150021064
This commit is contained in:
David Gumberg 2025-08-22 23:22:58 -07:00
parent d8bec61be2
commit 27e021ebc0

View File

@ -413,7 +413,7 @@ std::shared_ptr<CWallet> CreateWallet(WalletContext& context, const std::string&
}
// Make the wallet
context.chain->initMessage(_("Loading wallet…"));
context.chain->initMessage(_("Creating wallet…"));
std::shared_ptr<CWallet> wallet = CWallet::Create(context, name, std::move(database), wallet_creation_flags, error, warnings);
if (!wallet) {
error = Untranslated("Wallet creation failed.") + Untranslated(" ") + error;
@ -447,6 +447,7 @@ std::shared_ptr<CWallet> CreateWallet(WalletContext& context, const std::string&
}
}
WITH_LOCK(wallet->cs_wallet, wallet->LogStats());
NotifyWalletLoaded(context, wallet);
AddWallet(context, wallet);
wallet->postInitProcess();
@ -3075,8 +3076,6 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
return nullptr;
}
WITH_LOCK(walletInstance->cs_wallet, walletInstance->LogStats());
return walletInstance;
}