This ended up a bit different from Core's for obvious reasons
https://github.com/bitcoin/bitcoin/pull/17357/commits/b7541705d0abfbddf682a0134f3fa8a8e1d06cdf
---
Depends on D6904
Concludes backport of Core [[https://github.com/bitcoin/bitcoin/pull/17357 | PR17357]]