diff options
author | Andrew Chow <achow101-github@achow101.com> | 2021-07-18 22:53:26 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2021-07-19 12:25:11 -0400 |
commit | 25d99e6511d8c43b2025a89bcd8295de755346a7 (patch) | |
tree | 467679d286c6ed7b36ca85e8d23c70f32ea6252d /src/key_io.h | |
parent | e8f85e0e86e92e583b8984455b7bf9d0a777578a (diff) |
Reorder dumpwallet so that cs_main functions go first
DEBUG_LOCKORDER expects cs_wallet, cs_main, and cs_KeyStore to be
acquired in that order. However dumpwallet would take these in the order
cs_wallet, cs_KeyStore, cs_main. So when configured with
`--enable-debug`, it is possible to hit the lock order assertion when
using dumpwallet.
To fix this, cs_wallet and cs_KeyStore are no longer locked at the same
time. Instead cs_wallet will be locked first. Then the functions which
lock cs_main will be run. Lastly cs_KeyStore will be locked afterwards.
This avoids the lock order issue.
Furthermore, since GetKeyBirthTimes (only used by dumpwallet) also uses
a function that locks cs_main, and itself also locks cs_KeyStore, the
same reordering is done here.
Diffstat (limited to 'src/key_io.h')
0 files changed, 0 insertions, 0 deletions