scripted-diff: refactor: CWallet::LoadWallet->PopulateWalletFromDB
What changed, and why it matters
This commit is a simple rename of one internal wallet function from LoadWallet() to PopulateWalletFromDB(). It does not change what the code does, only its name. There is no security impact.
No security action needed. Treat as routine code maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
A scripted sed rename of CWallet::LoadWallet to CWallet::PopulateWalletFromDB across 8 files. The diff shows only identifier substitutions; no logic, control flow, locking, error handling, or data processing changes. The function body in src/wallet/wallet.cpp is identical except for the name. This is a pure refactoring change.
Changed components
src/wallet/wallet.cppsrc/wallet/wallet.hsrc/wallet/dump.cppsrc/wallet/wallettool.cppsrc/wallet/test/wallet_tests.cppsrc/wallet/test/walletload_tests.cppsrc/qt/test/addressbooktests.cppsrc/qt/test/wallettests.cppInspect captured patch +10 / −10
diff --git a/src/qt/test/addressbooktests.cpp b/src/qt/test/addressbooktests.cpp
index d2ac1306..f0f2c594 100644
--- a/src/qt/test/addressbooktests.cpp
+++ b/src/qt/test/addressbooktests.cpp
@@ -77,7 +77,7 @@ void TestAddAddressesToSendBook(interfaces::Node& node)
test.m_node.wallet_loader = wallet_loader.get();
node.setContext(&test.m_node);
const std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", CreateMockableWalletDatabase());
- wallet->LoadWallet();
+ wallet->PopulateWalletFromDB();
wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
{
LOCK(wallet->cs_wallet);
diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp
index 5e65dcca..c5e6e116 100644
--- a/src/qt/test/wallettests.cpp
+++ b/src/qt/test/wallettests.cpp
@@ -192,7 +192,7 @@ void SyncUpWallet(const std::shared_ptr<CWallet>& wallet, interfaces::Node& node
std::shared_ptr<CWallet> SetupDescriptorsWallet(interfaces::Node& node, TestChain100Setup& test, bool watch_only = false)
{
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", CreateMockableWalletDatabase());
- wallet->LoadWallet();
+ wallet->PopulateWalletFromDB();
LOCK(wallet->cs_wallet);
wallet->SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
if (watch_only) {
diff --git a/src/wallet/dump.cpp b/src/wallet/dump.cpp
index 6b193ad7..ee800a04 100644
--- a/src/wallet/dump.cpp
+++ b/src/wallet/dump.cpp
@@ -199,7 +199,7 @@ bool CreateFromDump(const ArgsManager& args, const std::string& name, const fs::
std::shared_ptr<CWallet> wallet(new CWallet(/*chain=*/nullptr, name, std::move(database)), WalletToolReleaseWallet);
{
LOCK(wallet->cs_wallet);
- DBErrors load_wallet_ret = wallet->LoadWallet();
+ DBErrors load_wallet_ret = wallet->PopulateWalletFromDB();
if (load_wallet_ret != DBErrors::LOAD_OK) {
error = strprintf(_("Error creating %s"), name);
return false;
diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp
index bcff2593..16fc8576 100644
--- a/src/wallet/test/wallet_tests.cpp
+++ b/src/wallet/test/wallet_tests.cpp
@@ -306,7 +306,7 @@ void TestLoadWallet(const std::string& name, DatabaseFormat format, std::functio
std::vector<bilingual_str> warnings;
auto database{MakeWalletDatabase(name, options, status, error)};
auto wallet{std::make_shared<CWallet>(chain.get(), "", std::move(database))};
- BOOST_CHECK_EQUAL(wallet->LoadWallet(), DBErrors::LOAD_OK);
+ BOOST_CHECK_EQUAL(wallet->PopulateWalletFromDB(), DBErrors::LOAD_OK);
WITH_LOCK(wallet->cs_wallet, f(wallet));
}
diff --git a/src/wallet/test/walletload_tests.cpp b/src/wallet/test/walletload_tests.cpp
index 0c69849d..ed33613f 100644
--- a/src/wallet/test/walletload_tests.cpp
+++ b/src/wallet/test/walletload_tests.cpp
@@ -52,7 +52,7 @@ BOOST_FIXTURE_TEST_CASE(wallet_load_descriptors, TestingSetup)
{
// Now try to load the wallet and verify the error.
const std::shared_ptr<CWallet> wallet(new CWallet(m_node.chain.get(), "", std::move(database)));
- BOOST_CHECK_EQUAL(wallet->LoadWallet(), DBErrors::UNKNOWN_DESCRIPTOR);
+ BOOST_CHECK_EQUAL(wallet->PopulateWalletFromDB(), DBErrors::UNKNOWN_DESCRIPTOR);
}
// Test 2
@@ -78,7 +78,7 @@ BOOST_FIXTURE_TEST_CASE(wallet_load_descriptors, TestingSetup)
{
// Now try to load the wallet and verify the error.
const std::shared_ptr<CWallet> wallet(new CWallet(m_node.chain.get(), "", std::move(database)));
- BOOST_CHECK_EQUAL(wallet->LoadWallet(), DBErrors::CORRUPT);
+ BOOST_CHECK_EQUAL(wallet->PopulateWalletFromDB(), DBErrors::CORRUPT);
BOOST_CHECK(found); // The error must be logged
}
}
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index d08d6782..4a464cdf 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -2290,7 +2290,7 @@ void CWallet::CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::ve
}
}
-DBErrors CWallet::LoadWallet()
+DBErrors CWallet::PopulateWalletFromDB()
{
LOCK(cs_wallet);
@@ -2855,7 +2855,7 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
// Load wallet
bool rescan_required = false;
- DBErrors nLoadWalletRet = walletInstance->LoadWallet();
+ DBErrors nLoadWalletRet = walletInstance->PopulateWalletFromDB();
if (nLoadWalletRet != DBErrors::LOAD_OK) {
if (nLoadWalletRet == DBErrors::CORRUPT) {
error = strprintf(_("Error loading %s: Wallet corrupted"), walletFile);
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index b341ac6d..e135b9d6 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -797,7 +797,7 @@ public:
bool IsFromMe(const CTransaction& tx) const;
CAmount GetDebit(const CTransaction& tx) const;
- DBErrors LoadWallet();
+ DBErrors PopulateWalletFromDB();
/** Erases the provided transactions from the wallet. */
util::Result<void> RemoveTxs(std::vector<Txid>& txs_to_remove) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
diff --git a/src/wallet/wallettool.cpp b/src/wallet/wallettool.cpp
index af32986c..b7012bd0 100644
--- a/src/wallet/wallettool.cpp
+++ b/src/wallet/wallettool.cpp
@@ -54,7 +54,7 @@ static std::shared_ptr<CWallet> MakeWallet(const std::string& name, const fs::pa
std::shared_ptr<CWallet> wallet_instance{new CWallet(/*chain=*/nullptr, name, std::move(database)), WalletToolReleaseWallet};
DBErrors load_wallet_ret;
try {
- load_wallet_ret = wallet_instance->LoadWallet();
+ load_wallet_ret = wallet_instance->PopulateWalletFromDB();
} catch (const std::runtime_error&) {
tfm::format(std::cerr, "Error loading %s. Is wallet being used by another process?\n", name);
return nullptr;
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.