Co-authored-by: ariard <antoine.riard@gmail.com>
This concludes backport of [[https://github.com/bitcoin/bitcoin/pull/22084 | core#22084]]
https://github.com/bitcoin/bitcoin/pull/22084/commits/ee862d6efb4c3c01e55f0d5d7a82cce75323cf40
Depends on D12134