mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 07:35:41 +00:00
Update for new peerset API (#644)
* Reputation changes require reason * Fixes * Bump version
This commit is contained in:
committed by
Gavin Wood
parent
72bfa8c615
commit
7cb57e7ab6
+16
-13
@@ -54,23 +54,26 @@ use crate::gossip::{POLKADOT_ENGINE_ID, GossipMessage};
|
||||
mod tests;
|
||||
|
||||
mod cost {
|
||||
pub(super) const UNEXPECTED_MESSAGE: i32 = -200;
|
||||
pub(super) const INVALID_FORMAT: i32 = -200;
|
||||
use sc_network::ReputationChange as Rep;
|
||||
pub(super) const UNEXPECTED_MESSAGE: Rep = Rep::new(-200, "Polkadot: Unexpected message");
|
||||
pub(super) const UNEXPECTED_ROLE: Rep = Rep::new(-200, "Polkadot: Unexpected role");
|
||||
pub(super) const INVALID_FORMAT: Rep = Rep::new(-200, "Polkadot: Bad message");
|
||||
|
||||
pub(super) const UNKNOWN_PEER: i32 = -50;
|
||||
pub(super) const COLLATOR_ALREADY_KNOWN: i32 = -100;
|
||||
pub(super) const BAD_COLLATION: i32 = -1000;
|
||||
pub(super) const BAD_POV_BLOCK: i32 = -1000;
|
||||
pub(super) const UNKNOWN_PEER: Rep = Rep::new(-50, "Polkadot: Unknown peer");
|
||||
pub(super) const COLLATOR_ALREADY_KNOWN: Rep = Rep::new( -100, "Polkadot: Known collator");
|
||||
pub(super) const BAD_COLLATION: Rep = Rep::new(-1000, "Polkadot: Bad collation");
|
||||
pub(super) const BAD_POV_BLOCK: Rep = Rep::new(-1000, "Polkadot: Bad POV block");
|
||||
}
|
||||
|
||||
mod benefit {
|
||||
pub(super) const EXPECTED_MESSAGE: i32 = 20;
|
||||
pub(super) const VALID_FORMAT: i32 = 20;
|
||||
use sc_network::ReputationChange as Rep;
|
||||
pub(super) const EXPECTED_MESSAGE: Rep = Rep::new(20, "Polkadot: Expected message");
|
||||
pub(super) const VALID_FORMAT: Rep = Rep::new(20, "Polkadot: Valid message format");
|
||||
|
||||
pub(super) const KNOWN_PEER: i32 = 5;
|
||||
pub(super) const NEW_COLLATOR: i32 = 10;
|
||||
pub(super) const GOOD_COLLATION: i32 = 100;
|
||||
pub(super) const GOOD_POV_BLOCK: i32 = 100;
|
||||
pub(super) const KNOWN_PEER: Rep = Rep::new(5, "Polkadot: Known peer");
|
||||
pub(super) const NEW_COLLATOR: Rep = Rep::new(10, "Polkadot: New collator");
|
||||
pub(super) const GOOD_COLLATION: Rep = Rep::new(100, "Polkadot: Good collation");
|
||||
pub(super) const GOOD_POV_BLOCK: Rep = Rep::new(100, "Polkadot: Good POV block");
|
||||
}
|
||||
|
||||
type FullStatus = GenericFullStatus<Block>;
|
||||
@@ -553,7 +556,7 @@ impl PolkadotProtocol {
|
||||
debug!(target: "p_net", "New collator role {:?} from {}", role, who);
|
||||
|
||||
if info.validator_keys.as_slice().is_empty() {
|
||||
ctx.report_peer(who, cost::UNEXPECTED_MESSAGE);
|
||||
ctx.report_peer(who, cost::UNEXPECTED_ROLE)
|
||||
} else {
|
||||
// update role for all saved session keys for this validator.
|
||||
let local_collations = &mut self.local_collations;
|
||||
|
||||
Reference in New Issue
Block a user