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:
Age Manning
2020-11-30 22:55:08 +00:00
parent 77f3539654
commit c718e81eaf
4 changed files with 30 additions and 5 deletions

View File

@@ -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()