[avalanche] Refactor reward ranking logic into its own comparator
Summary:
Sharing the reward ranking logic between the contender cache and peer manager makes it easier to reason about. This also cleans up the if statement in selectStakingRewardWinner that is difficult to read at a glance.
There is no change in behavior.
Test Plan:
ninja check check-functional
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D17495