mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +00:00
Add connected peers to protocol, use in sync provider (#1857)
* add connected peers to protocol, use in sync provider * use PeerId::random * address comments` * docs * fix import of PeerId * rewrite rpc tests using PeerId::random * whitespace * nits * remove option around peer id and remove field * further removal of the option around peer id * fix rpc tests
This commit is contained in:
committed by
Gav Wood
parent
ea7da0d4a4
commit
bc15fa31ff
@@ -134,6 +134,8 @@ where TProtos: IntoIterator<Item = RegisteredProtocol<TMessage>>,
|
||||
pub enum ServiceEvent<TMessage> {
|
||||
/// A custom protocol substream has been opened with a node.
|
||||
OpenedCustomProtocol {
|
||||
/// The Id of the node.
|
||||
peer_id: PeerId,
|
||||
/// Index of the node.
|
||||
node_index: NodeIndex,
|
||||
/// Protocol that has been opened.
|
||||
@@ -381,8 +383,9 @@ where TMessage: CustomMessage + Send + 'static {
|
||||
match self.swarm.poll() {
|
||||
Ok(Async::Ready(Some(BehaviourOut::CustomProtocolOpen { protocol_id, peer_id, version, endpoint }))) => {
|
||||
debug!(target: "sub-libp2p", "Opened custom protocol with {:?}", peer_id);
|
||||
let node_index = self.index_of_peer_or_assign(peer_id, endpoint);
|
||||
let node_index = self.index_of_peer_or_assign(peer_id.clone(), endpoint);
|
||||
break Ok(Async::Ready(Some(ServiceEvent::OpenedCustomProtocol {
|
||||
peer_id,
|
||||
node_index,
|
||||
protocol: protocol_id,
|
||||
version,
|
||||
|
||||
Reference in New Issue
Block a user