This removes a bunch of boilerplate, makes the code easier to read.
Also, C++11 member initialization avoids accidental uninitialized
members.
Can be reviewed with the git option "--word-diff-regex=." or with "git
difftool --tool=meld".
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/23054 | core#23054]]