mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +00:00
Use MIN associated const (#9199)
This commit is contained in:
@@ -105,7 +105,7 @@ mod rep {
|
||||
|
||||
/// Reputation change when a peer sent us a status message with a different
|
||||
/// genesis than us.
|
||||
pub const GENESIS_MISMATCH: Rep = Rep::new(i32::min_value(), "Genesis mismatch");
|
||||
pub const GENESIS_MISMATCH: Rep = Rep::new(i32::MIN, "Genesis mismatch");
|
||||
|
||||
/// Reputation change for peers which send us a block with an incomplete header.
|
||||
pub const INCOMPLETE_HEADER: Rep = Rep::new(-(1 << 20), "Incomplete header");
|
||||
|
||||
@@ -42,7 +42,7 @@ mod rep {
|
||||
use super::ReputationChange as Rep;
|
||||
|
||||
/// Reputation change when a peer sent us the same request multiple times.
|
||||
pub const SAME_REQUEST: Rep = Rep::new(i32::min_value(), "Same state request multiple times");
|
||||
pub const SAME_REQUEST: Rep = Rep::new(i32::MIN, "Same state request multiple times");
|
||||
}
|
||||
|
||||
/// Generates a [`ProtocolConfig`] for the block request protocol, refusing incoming requests.
|
||||
|
||||
@@ -45,7 +45,7 @@ use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedSender, TracingUnbounded
|
||||
pub use libp2p::PeerId;
|
||||
|
||||
/// We don't accept nodes whose reputation is under this value.
|
||||
const BANNED_THRESHOLD: i32 = 82 * (i32::min_value() / 100);
|
||||
const BANNED_THRESHOLD: i32 = 82 * (i32::MIN / 100);
|
||||
/// Reputation change for a node when we get disconnected from it.
|
||||
const DISCONNECT_REPUTATION_CHANGE: i32 = -256;
|
||||
/// Amount of time between the moment we disconnect from a node and the moment we remove it from
|
||||
@@ -107,7 +107,7 @@ impl ReputationChange {
|
||||
|
||||
/// New reputation change that forces minimum possible reputation.
|
||||
pub const fn new_fatal(reason: &'static str) -> ReputationChange {
|
||||
ReputationChange { value: i32::min_value(), reason }
|
||||
ReputationChange { value: i32::MIN, reason }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ fn test_once() {
|
||||
// If we generate 2, adjust a random reputation.
|
||||
2 => {
|
||||
if let Some(id) = known_nodes.iter().choose(&mut rng) {
|
||||
let val = Uniform::new_inclusive(i32::min_value(), i32::MAX)
|
||||
let val = Uniform::new_inclusive(i32::MIN, i32::MAX)
|
||||
.sample(&mut rng);
|
||||
peerset_handle.report_peer(id.clone(), ReputationChange::new(val, ""));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user