[bitcoin/bitcoin] Refactoring CRPCCommand with enum category (#13945)

isghe commented on this pull request.

> + HANDLE_CASE_RETURN(RPCCategory, blockchain);
+ HANDLE_CASE_RETURN(RPCCategory, control);
+ HANDLE_CASE_RETURN(RPCCategory, generating);
+ HANDLE_CASE_RETURN(RPCCategory, hidden);
+ HANDLE_CASE_RETURN(RPCCategory, mining);
+ HANDLE_CASE_RETURN(RPCCategory, network);
+ HANDLE_CASE_RETURN(RPCCategory, rawtransactions);
+ HANDLE_CASE_RETURN(RPCCategory, util);
+ HANDLE_CASE_RETURN(RPCCategory, wallet);
+ HANDLE_CASE_RETURN(RPCCategory, test);
+ // if you are missing a case, you’ll have a warning here
+ }
+ assert(0); // never fall down here

Yes and now we can see how much is important this refactoring, before making any others modifications, in this area: try figuring out how would be hard now and prone to errors, without this refactoring, to capitalise the category’s identifiers to remove that unwanted `boost::to_upper`.
Consider that without this refactoring, there is no easy way, to know wich and how many categories we have in the source code.
For similar reasons, it is necessary before working on properties like `visibility` or `status` etc… for CRPCCommand.

That is why I created this refactoring PR: to make easier, less prone errors, forward modifications.

Anyway now, knowing that it will help for next PRs, I’m going to uppercase the enum RPCCategory constants, and modify the «template» `HANDLE_CASE_RETURN(RPCCategory, blockchain)` used in `rpccategory::Label` to `case RPCCategory::BLOCKCHAIN: return «blockchain»` (observe the first char is lowercase not capitalised: that’s because the purpose of this PR is just refactoring, not fixing bug; removing that unwanted `boost::to_upper` deserve the importance of a new dedicated fixing PR).

About the `default: assert(false);`, with that we are losing compiler warning in the case we are not handling a new category

rpc/rpccategory.cpp: In function ‘std::__cxx11::string rpccategory::Label(RPCCategory)’:
rpc/rpccategory.cpp:21:12: warning: enumeration value ‘test2’ not handled in switch [-Wswitch]
switch (category)
So I think it should be better, not to handle the default case.