Files
reth/crates/net/discv4
Tomás 76e76bb651 feat: add trusted nodes configuration (#569)
* Add preferred nodes to config

* Add preferred nodes on boot

* Add flag in config for trusted only mode

* Add preferred nodes configuration to config

* Fix comment

* Add preferred nodes to config file

* Rename preferred_nodes to trusted_nodes

* Change preferred to trusted

I renamed preferred_nodes to trusted_nodes in various places.
Seems I missed quite a bit of them.

* Pull trusted_only from config

* Rename DiscoveryConfig to PeersConfig

* Fix last commit

Now actually renamed DiscoveryConfig

* Rename trusted_only to connect_trusted_nodes_only

* Add helper function

* Use HashSet for boot_nodes and trusted_nodes

* Change trusted nodes functions in ConfigBuilder

* Move trusted peers from discv4 to network config

* Add trusted nodes to peers on Manager creation

* Use NodeRecord in trusted_nodes config

* Fix comment

* Move trusted_nodes config to PeersConfig

* Add trusted nodes directly to peers

* Move network_config to Config impl

* Move start_network to NetworkConfig impl
2022-12-28 21:48:11 +01:00
..
2022-10-25 14:23:24 +02:00

discv4

This is a rust implementation of the Discovery v4 peer discovery protocol.

For comparison to Discovery v5, see discv5#comparison-with-node-discovery-v4

This is inspired by the discv5 crate and reuses its kademlia implementation.

Finding peers

The discovery service continuously attempts to connect to other nodes on the network until it has found enough peers. If UPnP (Universal Plug and Play) is supported by the router the service is running on, it will also accept connections from external nodes. In the discovery protocol, nodes exchange information about where the node can be reached to eventually establish RLPx sessions.

Trouble Shooting

The discv4 protocol depends on the local system clock. If the clock is not accurate it can cause connectivity issues because the expiration timestamps might be wrong.