Isolate the decision of whether to ban a peer to one place in the
code, rather than having it sprinkled throughout net_processing.
Co-authored-by: Anthony Towns <email@example.com>
Suhas Daftuar <firstname.lastname@example.org> John Newbery <email@example.com>
This is a partial backport of Core PR15141 : https://github.com/bitcoin/bitcoin/pull/15141/commits/8818729013e17c650a25f030b2b80e0997389155
Slightly modified because the original screws with locks and only fixes it toward the end.