Backport of core [[https://github.com/bitcoin/bitcoin/pull/17474 | PR17474]].
This has been adapted to match our codebase changes from core. Due to
thesIt introduces one changes to the switch needs to have a default statement or theway the unknown service bits are displayed,
compiler will always warn,to make them consistenly display as a bit number. so tThis backport does not change thematches what core does
behavior;when the backports are up-to-date and makes the code simpler.