Skip to content

Commit

Permalink
wallet: Assert that the wallet is not initialized in LoadWallet
Browse files Browse the repository at this point in the history
LoadWallet() cannot be run after the wallet has been initialized. So
assert that to avoid making this mistake in the future.
  • Loading branch information
achow101 committed Dec 11, 2023
1 parent fb0b6ca commit bd7f5d3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit bd7f5d3

Please sign in to comment.