mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 11:44:14 +01:00
Locking: Lock cs_KeyStore instead of cs_wallet in legacy keyman
This commit only affects locking behavior and doesn't have other changes.
This commit is contained in:
@@ -196,7 +196,7 @@ public:
|
||||
|
||||
static bool
|
||||
ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
||||
CWalletScanState &wss, std::string& strType, std::string& strErr) EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet, pwallet->GetLegacyScriptPubKeyMan()->cs_wallet)
|
||||
CWalletScanState &wss, std::string& strType, std::string& strErr) EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)
|
||||
{
|
||||
try {
|
||||
// Unserialize
|
||||
@@ -434,7 +434,6 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
|
||||
DBErrors result = DBErrors::LOAD_OK;
|
||||
|
||||
LOCK(pwallet->cs_wallet);
|
||||
AssertLockHeld(pwallet->GetLegacyScriptPubKeyMan()->cs_wallet);
|
||||
try {
|
||||
int nMinVersion = 0;
|
||||
if (m_batch.Read(DBKeys::MINVERSION, nMinVersion)) {
|
||||
@@ -518,6 +517,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
|
||||
if ((wss.nKeys + wss.nCKeys + wss.nWatchKeys) != wss.nKeyMeta) {
|
||||
auto spk_man = pwallet->GetLegacyScriptPubKeyMan();
|
||||
if (spk_man) {
|
||||
LOCK(spk_man->cs_KeyStore);
|
||||
spk_man->UpdateTimeFirstKey(1);
|
||||
}
|
||||
}
|
||||
@@ -713,7 +713,6 @@ bool WalletBatch::RecoverKeysOnlyFilter(void *callbackData, CDataStream ssKey, C
|
||||
{
|
||||
// Required in LoadKeyMetadata():
|
||||
LOCK(dummyWallet->cs_wallet);
|
||||
AssertLockHeld(dummyWallet->GetLegacyScriptPubKeyMan()->cs_wallet);
|
||||
fReadOK = ReadKeyValue(dummyWallet, ssKey, ssValue,
|
||||
dummyWss, strType, strErr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user