6 #ifndef KAGOME_NETWORK_REPUTATIONCHANGE 7 #define KAGOME_NETWORK_REPUTATIONCHANGE 11 #include <libp2p/peer/peer_id.hpp> 24 if (value < 0 and value + delta > 0) {
25 return {std::numeric_limits<Reputation>::min(), reason};
27 }
else if (delta > 0) {
28 if (value > 0 and value + delta < 0) {
29 return {std::numeric_limits<Reputation>::max(), reason};
32 return {value + delta, reason};
36 auto limit = value < 0 ? std::numeric_limits<Reputation>::min()
37 : std::numeric_limits<Reputation>::max();
38 if (static_cast<size_t>(limit / value) < times) {
39 return {limit, reason};
41 return {
static_cast<Reputation>(value * times), reason};
45 namespace reputation {
106 #endif // KAGOME_NETWORK_REPUTATIONCHANGE const ReputationChange PER_SIGNATURE_CHECKED
const ReputationChange OUT_OF_SCOPE_MESSAGE
const ReputationChange CATCH_UP_REQUEST_TIMEOUT
const ReputationChange UNKNOWN_VOTER
const ReputationChange BAD_CATCHUP_RESPONSE
const ReputationChange PAST_REJECTION
const ReputationChange INVALID_VIEW_CHANGE
const ReputationChange UNEXPECTED_DISCONNECT
const ReputationChange MALFORMED_COMMIT
const ReputationChange ROUND_MESSAGE
const ReputationChange INVALID_COMMIT
const ReputationChange BASIC_VALIDATED_COMMIT
const ReputationChange DUPLICATE_BLOCK_REQUEST
const ReputationChange BASIC_VALIDATED_CATCH_UP
const ReputationChange PER_BLOCK_LOADED
const ReputationChange PER_UNDECODABLE_BYTE
const ReputationChange BAD_SIGNATURE
const ReputationChange PER_EQUIVOCATION
const ReputationChange UNDECODABLE_NEIGHBOR_MESSAGE
const ReputationChange NEIGHBOR_MESSAGE
ReputationChange operator*(size_t times) const
const ReputationChange INVALID_CATCH_UP
const ReputationChange CATCH_UP_REPLY
const ReputationChange FUTURE_MESSAGE
const std::string_view reason
ReputationChange operator+(Reputation delta) const
const ReputationChange MALFORMED_CATCH_UP
const ReputationChange HONEST_OUT_OF_SCOPE_CATCH_UP