From bd7f5d33e3b9e01cd600afe1682b7afa935f68a3 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 11 Dec 2023 15:05:42 -0500 Subject: [PATCH] wallet: Assert that the wallet is not initialized in LoadWallet LoadWallet() cannot be run after the wallet has been initialized. So assert that to avoid making this mistake in the future. --- src/wallet/wallet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 4d4e23dd4c..892b9d51e4 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2292,6 +2292,8 @@ DBErrors CWallet::LoadWallet() { LOCK(cs_wallet); + Assert(m_spk_managers.empty()); + Assert(m_wallet_flags == 0); DBErrors nLoadWalletRet = WalletBatch(GetDatabase()).LoadWallet(this); if (nLoadWalletRet == DBErrors::NEED_REWRITE) {