-
Notifications
You must be signed in to change notification settings - Fork 130
NC-1936 discovery wiring for --node-whitelist #365
NC-1936 discovery wiring for --node-whitelist #365
Conversation
…scoveryController
@@ -106,6 +107,7 @@ | |||
|
|||
private final PeerDiscoveryAgent agent; | |||
private final PeerBlacklist peerBlacklist; | |||
private final NodeWhitelistController nodeWhitelistController; |
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.
Suggestion: s/nodeWhiteListController/nodeWhitelist
Reason being, the term Controller
is unnecessary, brings no additional contextual meaning.
} | ||
|
||
public static boolean isNodeWhitelistSet() { | ||
return nodeWhitelistSet; | ||
public boolean isNodeWhitelisted(final Peer node) { |
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.
Suggestion: s/isNodeWhiteListed/contains
Reason: as a public scoped method, it would reduce repetition in context when calling the method i.e. nodeWhiteList.contains() vs nodeWhitelist.isNodeWhiteListed()
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 also returns true if the whitelist is not set - in which case it doesn't 'contain' anything. contains() doesn't really cover both cases
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.
If there is no white list, then everything is whitelisted. The whitelist contains the node, as it is the set of all nodes.
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
PR description
If --node-whitelist is set, discard any messages from non-whitelisted peers.
Fixed Issue(s)
NC-1936