mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
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.
This commit is contained in:
parent
956916806a
commit
012ca1c9e4
@ -1489,7 +1489,6 @@ string CWallet::SendMoneyToDestination(const CTxDestination& address, int64_t nV
|
|||||||
|
|
||||||
DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
|
DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_wallet); // setKeyPool
|
|
||||||
if (!fFileBacked)
|
if (!fFileBacked)
|
||||||
return DB_LOAD_OK;
|
return DB_LOAD_OK;
|
||||||
fFirstRunRet = false;
|
fFirstRunRet = false;
|
||||||
@ -1498,6 +1497,7 @@ DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
|
|||||||
{
|
{
|
||||||
if (CDB::Rewrite(strWalletFile, "\x04pool"))
|
if (CDB::Rewrite(strWalletFile, "\x04pool"))
|
||||||
{
|
{
|
||||||
|
LOCK(cs_wallet);
|
||||||
setKeyPool.clear();
|
setKeyPool.clear();
|
||||||
// Note: can't top-up keypool here, because wallet is locked.
|
// Note: can't top-up keypool here, because wallet is locked.
|
||||||
// User will be prompted to unlock wallet the next operation
|
// User will be prompted to unlock wallet the next operation
|
||||||
|
Loading…
Reference in New Issue
Block a user