Based on #7287 to avoid consensus/consensus.cpp having to depend on FormatStateMessage() (static function in main.cpp) temporarily. This moves most of the remaining consensus-critical code in main.cpp to the consensus directory.
Even if I haven’t published the promised document explaining the libconsensus longer term plan, all that is needed to review this is being able to tell whether all the moved functions are consensus critical or not; and then make sure that the code is only being moved without changes. As other times, I have introduced trivial non-functional changes that those who check “moveonlyness” should notice.