> Using RPC (wait_for_rpc_connection) has several issue:
>
> It polls in a loop, which might be slow
> It tries to read the RPC cookie file, which might not be present, thus leading to intermittent issues
>
> Fix both by using Popen.wait
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/20613 | core#20613]]