You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge bitcoin#22492: wallet: Reorder locks in dumpwallet to avoid lock order assertion
9b85a5e tests: Test for dumpwallet lock order issue (Andrew Chow)
25d99e6 Reorder dumpwallet so that cs_main functions go first (Andrew Chow)
Pull request description:
When a wallet is loaded which has an unconfirmed transaction in the mempool, it will end up establishing the lock order of cs_wallet -> cs_main -> cs_KeyStore. If `dumpwallet` is used on this wallet, then a lock order of cs_wallet -> cs_KeyStore -> cs_main will be used, which causes a lock order assertion. This PR fixes this by reordering `dumpwallet` and `GetKeyBirthTimes` (only used by `dumpwallet`). Specifically, in both functions, the function calls which lock cs_main are done prior to locking cs_KeyStore. This avoids the lock order issue.
Additionally, I have added a test case to `wallet_dump.py`. Of course testing this requires `--enable-debug`.
Fixesbitcoin#22489
ACKs for top commit:
MarcoFalke:
review ACK 9b85a5e 🎰
ryanofsky:
Code review ACK 9b85a5e. Nice to reduce lock scope, and good test!
prayank23:
tACK bitcoin@9b85a5e
lsilva01:
Tested ACK bitcoin@9b85a5e under the same conditions reported in issue bitcoin#22489 and the `dumpwallet` command completed successfully.
Tree-SHA512: d370a8f415ad64ee6a538ff419155837bcdbb167e3831b06572562289239028c6b46d80b23d227286afe875d9351f3377574ed831549ea426fb926af0e19c755
0 commit comments