mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-12 04:42:36 -03:00
Bugfix: Wallet: Lock cs_wallet for SignMessage
cs_desc_main is typically locked within scope of a cs_wallet lock, but: CWallet::IsLocked locks cs_wallet ...called from DescriptorScriptPubKeyMan::GetKeys ...called from DescriptorScriptPubKeyMan::GetSigningProvider which locks cs_desc_main first, but has no access to cs_wallet ...called from DescriptorScriptPubKeyMan::SignMessage ...called from CWallet::SignMessage which can access and lock cs_wallet Resolve the out of order locks by grabbing cs_wallet in CWallet::SignMessage first
This commit is contained in:
parent
831675c8dc
commit
a60d9eb9e6
1 changed files with 1 additions and 0 deletions
|
@ -2588,6 +2588,7 @@ SigningResult CWallet::SignMessage(const std::string& message, const PKHash& pkh
|
|||
CScript script_pub_key = GetScriptForDestination(pkhash);
|
||||
for (const auto& spk_man_pair : m_spk_managers) {
|
||||
if (spk_man_pair.second->CanProvide(script_pub_key, sigdata)) {
|
||||
LOCK(cs_wallet); // DescriptorScriptPubKeyMan calls IsLocked which can lock cs_wallet in a deadlocking order
|
||||
return spk_man_pair.second->SignMessage(message, pkhash, str_sig);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue