File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1280,6 +1280,7 @@ void CWallet::LoadToWallet(CWalletTx& wtxIn)
12801280 // If wallet doesn't have a chain (e.g wallet-tool), lock can't be taken.
12811281 auto locked_chain = LockChain ();
12821282 if (locked_chain) {
1283+ LockAssertion lock (::cs_main);
12831284 Optional<int > block_height = locked_chain->getBlockHeight (wtxIn.m_confirm .hashBlock );
12841285 if (block_height) {
12851286 // Update cached block height variable since it not stored in the
@@ -4119,7 +4120,9 @@ DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
41194120 // tx status. If lock can't be taken (e.g wallet-tool), tx confirmation
41204121 // status may be not reliable.
41214122 auto locked_chain = LockChain ();
4122- LockAssertion lock (::cs_main);
4123+ if (locked_chain) {
4124+ LockAssertion lock (::cs_main);
4125+ }
41234126 LOCK (cs_wallet);
41244127
41254128 fFirstRunRet = false ;
Original file line number Diff line number Diff line change @@ -510,7 +510,9 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
510510 DBErrors result = DBErrors::LOAD_OK;
511511
512512 auto locked_chain = pwallet->LockChain ();
513- LockAssertion lock (::cs_main);
513+ if (locked_chain) {
514+ LockAssertion lock (::cs_main);
515+ }
514516 LOCK (pwallet->cs_wallet );
515517 try {
516518 int nMinVersion = 0 ;
You can’t perform that action at this time.
0 commit comments