-
Notifications
You must be signed in to change notification settings - Fork 225
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
Add list of spare and faulty nodes to PeerList #349
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.
Code looks 👌 I’d like to reread the current spec before approving (I’m lagging behind a bit here)
primary: PeerId, | ||
witnesses: HashSet<PeerId>, |
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.
witnesses are what is currently called Secondaries in the spec. Will the naming be aligned or is there a particular reason for the difference?
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.
I picked witnesses
to be consistent with the naming in the multi-peer JSON tests, but you are right that we should align them. Let's already merge this and I'll open an issue to track this and to discuss which name we want to keep.
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.
LGTM 👍
} | ||
|
||
/// Get a list of references to all the witnesses, | ||
/// (ie. all peers which are not the primary). | ||
pub fn witnesses(&self) -> Vec<&Instance> { | ||
self.peers | ||
self.instances |
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.
This method now seems to be wrong as it will return all Instance
which are not primary
(as per the docs above but not what we want when doing fork detection), therefore we might be returning faulty nodes, and we are going to contact all instances in this peer list. Effectively communicating with all full nodes instead of a subset defined in witnesses
. This could probably be fixed in #397 @romac
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.
Fixed in e371271.
Neither list are currently used but have been added to match the spec more closely.