Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/proofcomparator.h
Show All 18 Lines | struct ProofComparator { | ||||
bool operator()(const Proof &lhs, const Proof &rhs) const { | bool operator()(const Proof &lhs, const Proof &rhs) const { | ||||
uint32_t scoreLhs = lhs.getScore(); | uint32_t scoreLhs = lhs.getScore(); | ||||
uint32_t scoreRhs = rhs.getScore(); | uint32_t scoreRhs = rhs.getScore(); | ||||
return (scoreLhs != scoreRhs) ? scoreLhs > scoreRhs | return (scoreLhs != scoreRhs) ? scoreLhs > scoreRhs | ||||
: lhs.getId() < rhs.getId(); | : lhs.getId() < rhs.getId(); | ||||
} | } | ||||
bool operator()(const std::shared_ptr<Proof> &lhs, | bool operator()(const ProofRef &lhs, const ProofRef &rhs) const { | ||||
const std::shared_ptr<Proof> &rhs) const { | |||||
return (*this)(*lhs, *rhs); | return (*this)(*lhs, *rhs); | ||||
} | } | ||||
}; | }; | ||||
} // namespace avalanche | } // namespace avalanche | ||||
#endif // BITCOIN_AVALANCHE_PROOFCOMPARATOR_H | #endif // BITCOIN_AVALANCHE_PROOFCOMPARATOR_H |