-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: dont gossip to disconnected nodes if there are no connected nodes available #1051
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛵
portalnet/src/overlay_service.rs
Outdated
let state = match set_connected { | ||
true => ConnectionState::Connected, | ||
false => ConnectionState::Disconnected, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is maybe a personal preference, but I like more the following syntax:
let state = match set_connected { | |
true => ConnectionState::Connected, | |
false => ConnectionState::Disconnected, | |
}; | |
let state = if set_connected { | |
ConnectionState::Connected | |
} else { | |
ConnectionState::Disconnected, | |
} | |
}; |
@@ -398,7 +398,7 @@ where | |||
command_tx | |||
} | |||
|
|||
fn add_bootnodes(&mut self, bootnode_enrs: Vec<Enr>) { | |||
fn add_bootnodes(&mut self, bootnode_enrs: Vec<Enr>, set_connected: bool) { | |||
// Attempt to insert bootnodes into the routing table in a disconnected state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to update this comment and adding a short docstring for this function explaining the set_connected
argument would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thanks for wrapping this up. Just few grammar bugs to point out. Docstrings w/ good grammar are good imo.
@@ -398,7 +398,11 @@ where | |||
command_tx | |||
} | |||
|
|||
fn add_bootnodes(&mut self, bootnode_enrs: Vec<Enr>) { | |||
/// Insert a vector of enr's into the routing table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Insert a vector of enrs into the routing table
fn add_bootnodes(&mut self, bootnode_enrs: Vec<Enr>) { | ||
/// Insert a vector of enr's into the routing table | ||
/// set_connected: should only be true for tests, false for production code | ||
/// Tests what use this function are testing if adding to queue's work not if our connection code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests that use this function are testing if adding to queues works, not if our connection code works.
What was wrong?
fixes #1049
How was it fixed?
Certain tests where checking if certain functions were working by putting dummy values into our kbuckets. Since we have strict standards for how we handle connected vs disconnected this test failed as it was written before this connection standard was in place.
The solution? set it as connect, this doesn't matter as these tests aren't meant to test the status of the node functionality.