Closed knst closed 4 months ago
Changing order of locking cs_main and cs_wallet to prevent a deadlock.
cs_main
cs_wallet
There's call protx_list -> BuildDMNListEntry -> CheckWalletOwnsScript:
protx_list
BuildDMNListEntry
CheckWalletOwnsScript
return WITH_LOCK(pwallet->cs_wallet, return pwallet->IsMine(script)) == isminetype::ISMINE_SPENDABLE;
It can cause a deadlock due to wrong order of locks (cs_wallet supposed to be blocked in prior of cs_main)
This PR adds and extra lock of cs_wallet and reduce scope of cs_main for a bit
Deadlock warning is reproduced with this PR: https://github.com/dashpay/dash/pull/6003
N/A
Issue being fixed or feature implemented
Changing order of locking
cs_main
andcs_wallet
to prevent a deadlock.There's call
protx_list
->BuildDMNListEntry
->CheckWalletOwnsScript
:It can cause a deadlock due to wrong order of locks (cs_wallet supposed to be blocked in prior of cs_main)
What was done?
This PR adds and extra lock of cs_wallet and reduce scope of cs_main for a bit
How Has This Been Tested?
Deadlock warning is reproduced with this PR: https://github.com/dashpay/dash/pull/6003
Breaking Changes
N/A
Checklist: