Skip to content

Commit b16f8cd

Browse files
UdjinM6Munkybooty
authored andcommitted
fix 16034
1 parent 95a905f commit b16f8cd

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/wallet/wallet.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff 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;

src/wallet/walletdb.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)