Skip to content
Snippets Groups Projects
Unverified Commit f19640bd authored by Dmitry Markin's avatar Dmitry Markin Committed by GitHub
Browse files

Log peerset set ID -> protocol name mapping (#7005)

To simplify debugging of peerset related issues like
https://github.com/paritytech/polkadot-sdk/issues/6573#issuecomment-2563091343.

---------

Co-authored-by: command-bot <>
parent cdf3a2dc
Branches
No related merge requests found
Pipeline #510400 waiting for manual action with stages
in 1 hour, 9 minutes, and 39 seconds
title: Log peerset set ID -> protocol name mapping
doc:
- audience: Node Dev
description: To simplify debugging of peerset related issues like https://github.com/paritytech/polkadot-sdk/issues/6573#issuecomment-2563091343.
crates:
- name: sc-network
bump: patch
......@@ -34,7 +34,7 @@ use libp2p::{
},
Multiaddr, PeerId,
};
use log::warn;
use log::{debug, warn};
use codec::DecodeAll;
use sc_network_common::role::Roles;
......@@ -53,6 +53,9 @@ mod notifications;
pub mod message;
// Log target for this file.
const LOG_TARGET: &str = "sub-libp2p";
/// Maximum size used for notifications in the block announce and transaction protocols.
// Must be equal to `max(MAX_BLOCK_ANNOUNCE_SIZE, MAX_TRANSACTIONS_SIZE)`.
pub(crate) const BLOCK_ANNOUNCES_TRANSACTIONS_SUBSTREAM_SIZE: u64 = MAX_RESPONSE_SIZE;
......@@ -124,6 +127,10 @@ impl<B: BlockT> Protocol<B> {
handle.set_metrics(notification_metrics.clone());
});
protocol_configs.iter().enumerate().for_each(|(i, (p, _, _))| {
debug!(target: LOG_TARGET, "Notifications protocol {:?}: {}", SetId::from(i), p.name);
});
(
Notifications::new(
protocol_controller_handles,
......@@ -164,7 +171,7 @@ impl<B: BlockT> Protocol<B> {
{
self.behaviour.disconnect_peer(peer_id, SetId::from(position));
} else {
warn!(target: "sub-libp2p", "disconnect_peer() with invalid protocol name")
warn!(target: LOG_TARGET, "disconnect_peer() with invalid protocol name")
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment