Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
f514bc38
Commit
f514bc38
authored
2 years ago
by
Nazar Mokrynskyi
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Ignore boot and reserved nodes with peer ID the same as in local node itself (#11851)
parent
74f0f45b
Branches
gh-readonly-queue/master/pr-3955-9b378a2ffef1d5846872adc4336341805bffbc30
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/client/network/src/service.rs
+41
-4
41 additions, 4 deletions
substrate/client/network/src/service.rs
with
41 additions
and
4 deletions
substrate/client/network/src/service.rs
+
41
−
4
View file @
f514bc38
...
...
@@ -148,6 +148,47 @@ where
/// for the network processing to advance. From it, you can extract a `NetworkService` using
/// `worker.service()`. The `NetworkService` can be shared through the codebase.
pub
fn
new
(
mut
params
:
Params
<
B
,
H
,
Client
>
)
->
Result
<
Self
,
Error
>
{
// Private and public keys configuration.
let
local_identity
=
params
.network_config.node_key
.clone
()
.into_keypair
()
?
;
let
local_public
=
local_identity
.public
();
let
local_peer_id
=
local_public
.to_peer_id
();
params
.network_config.boot_nodes
=
params
.network_config
.boot_nodes
.into_iter
()
.filter
(|
boot_node
|
{
if
boot_node
.peer_id
==
local_peer_id
{
warn!
(
target
:
"sub-libp2p"
,
"Local peer ID used in bootnode, ignoring: {}"
,
boot_node
,
);
false
}
else
{
true
}
})
.collect
();
params
.network_config.default_peers_set.reserved_nodes
=
params
.network_config
.default_peers_set
.reserved_nodes
.into_iter
()
.filter
(|
reserved_node
|
{
if
reserved_node
.peer_id
==
local_peer_id
{
warn!
(
target
:
"sub-libp2p"
,
"Local peer ID used in reserved node, ignoring: {}"
,
reserved_node
,
);
false
}
else
{
true
}
})
.collect
();
// Ensure the listen addresses are consistent with the transport.
ensure_addresses_consistent_with_transport
(
params
.network_config.listen_addresses
.iter
(),
...
...
@@ -190,10 +231,6 @@ where
.extra_sets
.insert
(
0
,
transactions_handler_proto
.set_config
());
// Private and public keys configuration.
let
local_identity
=
params
.network_config.node_key
.clone
()
.into_keypair
()
?
;
let
local_public
=
local_identity
.public
();
let
local_peer_id
=
local_public
.to_peer_id
();
info!
(
target
:
"sub-libp2p"
,
"🏷 Local node identity is: {}"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment