> The test doesn't work currently because the log might be finalized before `wait_for_debug_log` is started, in which case it will assume the log is empty and fail to detect any line.
>
> Fix this by calling wait_for_debug_log first. Fixes core#24060.
This concludes backport of [[https://github.com/bitcoin/bitcoin/pull/24192 | core#24192]]
Depends on D12620