Skip to content

Commit

Permalink
Log mapping between peerset set IDs and notification protocol names
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-markin committed Dec 26, 2024
1 parent 5b04b45 commit 673fa65
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions substrate/client/network/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use libp2p::{
},
Multiaddr, PeerId,
};
use log::warn;
use log::{debug, warn};

use codec::DecodeAll;
use sc_network_common::role::Roles;
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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")
}
}

Expand Down

0 comments on commit 673fa65

Please sign in to comment.