> sync: Improve CheckLastCritical()
>
> This commit adds actual lock stack logging if check fails.
> [skip ci] sync: Check precondition in LEAVE_CRITICAL_SECTION() macro
>
> This change reveals a bug in the wallet_tests/CreateWalletFromFile test,
> that will be fixed in the following commit.
> test: Fix inconsistent lock order in wallet_tests/CreateWallet
This is a backport of core#19982