From 27e021ebc0dd3517a71f3ddb38ed265a19693d4c Mon Sep 17 00:00:00 2001 From: David Gumberg Date: Fri, 22 Aug 2025 23:22:58 -0700 Subject: [PATCH] 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 --- src/wallet/wallet.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index a11f8511dd1..d7663ed0e62 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -413,7 +413,7 @@ std::shared_ptr CreateWallet(WalletContext& context, const std::string& } // Make the wallet - context.chain->initMessage(_("Loading wallet…")); + context.chain->initMessage(_("Creating wallet…")); std::shared_ptr 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 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::Create(WalletContext& context, const std::stri return nullptr; } - WITH_LOCK(walletInstance->cs_wallet, walletInstance->LogStats()); - return walletInstance; }