Skip to content

Commit 012ca1c

Browse files
committed
LoadWallet: acquire cs_wallet mutex before clearing setKeyPool
Make the function mutex-aware, to prevent having to lock cs_wallet at the call site in Init.
1 parent 9569168 commit 012ca1c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,6 @@ string CWallet::SendMoneyToDestination(const CTxDestination& address, int64_t nV
14891489

14901490
DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
14911491
{
1492-
AssertLockHeld(cs_wallet); // setKeyPool
14931492
if (!fFileBacked)
14941493
return DB_LOAD_OK;
14951494
fFirstRunRet = false;
@@ -1498,6 +1497,7 @@ DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
14981497
{
14991498
if (CDB::Rewrite(strWalletFile, "\x04pool"))
15001499
{
1500+
LOCK(cs_wallet);
15011501
setKeyPool.clear();
15021502
// Note: can't top-up keypool here, because wallet is locked.
15031503
// User will be prompted to unlock wallet the next operation

0 commit comments

Comments
 (0)