mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 04:01:51 +00:00
Add privacy option (#2016)
Adds a `--privacy` CLI flag to the beacon node that users may opt into. This does two things: - Removes client identifying information from the identify libp2p protocol - Changes the default graffiti to "" if no graffiti is set.
This commit is contained in:
@@ -151,11 +151,19 @@ impl<TSpec: EthSpec> Behaviour<TSpec> {
|
||||
) -> error::Result<Self> {
|
||||
let behaviour_log = log.new(o!());
|
||||
|
||||
let identify = Identify::new(
|
||||
"lighthouse/libp2p".into(),
|
||||
lighthouse_version::version_with_platform(),
|
||||
local_key.public(),
|
||||
);
|
||||
let identify = if net_conf.private {
|
||||
Identify::new(
|
||||
"".into(),
|
||||
"".into(),
|
||||
local_key.public(), // Still send legitimate public key
|
||||
)
|
||||
} else {
|
||||
Identify::new(
|
||||
"lighthouse/libp2p".into(),
|
||||
lighthouse_version::version_with_platform(),
|
||||
local_key.public(),
|
||||
)
|
||||
};
|
||||
|
||||
let enr_fork_id = network_globals
|
||||
.local_enr()
|
||||
|
||||
@@ -88,6 +88,10 @@ pub struct Config {
|
||||
/// runtime.
|
||||
pub import_all_attestations: bool,
|
||||
|
||||
/// Indicates if the user has set the network to be in private mode. Currently this
|
||||
/// prevents sending client identifying information over identify.
|
||||
pub private: bool,
|
||||
|
||||
/// List of extra topics to initially subscribe to as strings.
|
||||
pub topics: Vec<GossipKind>,
|
||||
}
|
||||
@@ -188,6 +192,7 @@ impl Default for Config {
|
||||
client_version: lighthouse_version::version_with_platform(),
|
||||
disable_discovery: false,
|
||||
upnp_enabled: true,
|
||||
private: false,
|
||||
subscribe_all_subnets: false,
|
||||
import_all_attestations: false,
|
||||
topics: Vec::new(),
|
||||
|
||||
Reference in New Issue
Block a user