https://github.com/bitcoin/bitcoin/pull/15901/commits/1b602f6fed2a6a03fd4d463bc56fa9eb0c4c779c
(note: easier visualized by hiding whitespace changes. in fact I reset
the incoming changes from Core, removed the two brackets and formatted.
less error prone that way.)
Depends on D7032
Concludes backport of Core PR15901