mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-07 07:18:03 +00:00
Support querying peer reputation (#2392)
# Description Trivial change that resolves https://github.com/paritytech/polkadot-sdk/issues/2185. Since there was a mix of `who` and `peer_id` argument names nearby I changed them all to `peer_id`. # Checklist - [x] My PR includes a detailed description as outlined in the "Description" section above - [x] My PR follows the [labeling requirements](CONTRIBUTING.md#Process) of this project (at minimum one label for `T` required) - [x] I have made corresponding changes to the documentation (if applicable) - [ ] I have added tests that prove my fix is effective or that my feature works (if applicable) --------- Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -155,12 +155,15 @@ pub trait NetworkPeers {
|
||||
|
||||
/// Report a given peer as either beneficial (+) or costly (-) according to the
|
||||
/// given scalar.
|
||||
fn report_peer(&self, who: PeerId, cost_benefit: ReputationChange);
|
||||
fn report_peer(&self, peer_id: PeerId, cost_benefit: ReputationChange);
|
||||
|
||||
/// Get peer reputation.
|
||||
fn peer_reputation(&self, peer_id: &PeerId) -> i32;
|
||||
|
||||
/// Disconnect from a node as soon as possible.
|
||||
///
|
||||
/// This triggers the same effects as if the connection had closed itself spontaneously.
|
||||
fn disconnect_peer(&self, who: PeerId, protocol: ProtocolName);
|
||||
fn disconnect_peer(&self, peer_id: PeerId, protocol: ProtocolName);
|
||||
|
||||
/// Connect to unreserved peers and allow unreserved peers to connect for syncing purposes.
|
||||
fn accept_unreserved_peers(&self);
|
||||
@@ -254,16 +257,16 @@ where
|
||||
T::add_known_address(self, peer_id, addr)
|
||||
}
|
||||
|
||||
fn report_peer(&self, who: PeerId, cost_benefit: ReputationChange) {
|
||||
// TODO: when we get rid of `Peerset`, we'll likely need to add some kind of async
|
||||
// interface to `PeerStore`, otherwise we'll have trouble calling functions accepting
|
||||
// `&mut self` via `Arc`.
|
||||
// See https://github.com/paritytech/substrate/issues/14170.
|
||||
T::report_peer(self, who, cost_benefit)
|
||||
fn report_peer(&self, peer_id: PeerId, cost_benefit: ReputationChange) {
|
||||
T::report_peer(self, peer_id, cost_benefit)
|
||||
}
|
||||
|
||||
fn disconnect_peer(&self, who: PeerId, protocol: ProtocolName) {
|
||||
T::disconnect_peer(self, who, protocol)
|
||||
fn peer_reputation(&self, peer_id: &PeerId) -> i32 {
|
||||
T::peer_reputation(self, peer_id)
|
||||
}
|
||||
|
||||
fn disconnect_peer(&self, peer_id: PeerId, protocol: ProtocolName) {
|
||||
T::disconnect_peer(self, peer_id, protocol)
|
||||
}
|
||||
|
||||
fn accept_unreserved_peers(&self) {
|
||||
|
||||
Reference in New Issue
Block a user