mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
refactor/reputation: unify the values used (#2462)
* refactor/reputation: unify the values used * chore/rep: rename Annoy* to Cost*, make duplicate message Cost*Repeated * fix/reputation: lost and found, convert at the boundary to substrate * refactor/rep: move conversion to base reputation one level down, left conversions * fix/rep: order of magnitude adjustments Thanks pierre! * remove spaces * chore/rep: give rationale for order of magnitude * refactor/rep: move UnifiedReputationChange to separate file * fix/rep: order of magnitudes correction
This commit is contained in:
committed by
GitHub
parent
62c5896592
commit
1e2161258b
@@ -29,7 +29,7 @@ use sc_network::{NetworkService, IfDisconnected};
|
||||
use polkadot_node_network_protocol::{
|
||||
peer_set::PeerSet,
|
||||
request_response::{OutgoingRequest, Requests},
|
||||
PeerId, ReputationChange,
|
||||
PeerId, UnifiedReputationChange as Rep,
|
||||
};
|
||||
use polkadot_primitives::v1::{Block, Hash};
|
||||
use polkadot_subsystem::{SubsystemError, SubsystemResult};
|
||||
@@ -86,7 +86,7 @@ where
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum NetworkAction {
|
||||
/// Note a change in reputation for a peer.
|
||||
ReputationChange(PeerId, ReputationChange),
|
||||
ReputationChange(PeerId, Rep),
|
||||
/// Write a notification to a given peer on the given peer-set.
|
||||
WriteNotification(PeerId, PeerSet, Vec<u8>),
|
||||
}
|
||||
@@ -111,7 +111,7 @@ pub trait Network: Send + 'static {
|
||||
fn report_peer(
|
||||
&mut self,
|
||||
who: PeerId,
|
||||
cost_benefit: ReputationChange,
|
||||
cost_benefit: Rep,
|
||||
) -> BoxFuture<SubsystemResult<()>> {
|
||||
async move {
|
||||
self.action_sink()
|
||||
@@ -167,7 +167,7 @@ impl Network for Arc<NetworkService<Block, Hash>> {
|
||||
cost_benefit,
|
||||
peer
|
||||
);
|
||||
self.0.report_peer(peer, cost_benefit)
|
||||
self.0.report_peer(peer, cost_benefit.into_base_rep())
|
||||
}
|
||||
NetworkAction::WriteNotification(peer, peer_set, message) => self
|
||||
.0
|
||||
|
||||
Reference in New Issue
Block a user