helium / erlang-libp2p

An Erlang implementation of libp2p swarms
https://helium.github.io/erlang-libp2p
Apache License 2.0
121 stars 34 forks source link

Enable force setting network id #436

Closed jadeallenx closed 2 years ago

jadeallenx commented 2 years ago

Problem to solve: When a node isn't following the chain (like a seed node), then we need a way to force set a network id so that the peerbook won't store entries with an undefined network id, or a network id that isn't the same as ours. This leads to seed nodes holding entries and gossiping nodes it shouldn't really be storing or gossiping.

Solution: Enable a new option in the swarm supervisor to force set a network id if supplied by the Erlang environment in force_network_id. PR works with and requires helium/blockchain-core#1287 and helium/blockchain-core#1384 and a forthcoming PR in miner to add the environment variable to the appropriate config.src templates