$CMTHOME/config/config.toml 文件进行配置。
Seed 模式
--p2p.seed_mode
节点以 seed 模式运行。在 seed 模式下,节点会持续爬取网络中的对等节点,
并在收到传入连接后共享部分对等节点信息,然后断开连接。
Seeds
--p2p.seeds “[email protected]:26656,[email protected]:4444”
当我们需要更多对等节点时,会拨号连接这些 seed 节点。它们应返回一组对等节点列表,然后断开连接。
如果地址簿中已经有足够多的对等节点,我们可能永远都不需要拨号连接它们。
持久对等节点
--p2p.persistent_peers “[email protected]:26656,[email protected]:26656”
拨号连接这些对等节点,并在连接失败时自动重新拨号。
这些节点被设计为可信的持久对等节点,可以帮助我们在 p2p 网络中建立稳定锚点。
自动重拨采用指数退避策略,并会在尝试连接一天后放弃。
但如果 persistent_peers_max_dial_period 被设置为大于零,
则在指数退避期间,对每个持久对等节点的两次拨号之间的暂停时间不会超过 persistent_peers_max_dial_period,
并且我们会持续重试而不会放弃。
注意: 如果 seeds 与 persistent_peers 有交集,
系统会警告用户 seed 节点可能会自动关闭连接,
因此节点可能无法保持持久连接。
私有对等节点
--p2p.private_peer_ids “id100000000000000000000000000000000,id200000000000000000000000000000000”
这些是不会被添加到地址簿中,也不会被传播给其他对等节点的节点 ID。
它们仅对我们自己保持私有。
无条件对等节点
--p2p.unconditional_peer_ids “id100000000000000000000000000000000,id200000000000000000000000000000000”
这些是允许建立入站或出站连接的对等节点 ID,
无论用户节点的 max_num_inbound_peers 或 max_num_outbound_peers 是否已经达到限制。
Here we describe configuration options around the Peer Exchange. These can be set using flags or via the
$CMTHOME/config/config.toml file.
Seed Mode
--p2p.seed_mode
The node operates in seed mode. In seed mode, a node continuously crawls the network for peers,
and upon incoming connection shares some peers and disconnects.
Seeds
--p2p.seeds “[email protected]:26656,[email protected]:4444”
Dials these seeds when we need more peers. They should return a list of peers and then disconnect.
If we already have enough peers in the address book, we may never need to dial them.
Persistent Peers
--p2p.persistent_peers “[email protected]:26656,[email protected]:26656”
Dial these peers and auto-redial them if the connection fails.
These are intended to be trusted persistent peers that can help
anchor us in the p2p network. The auto-redial uses exponential
backoff and will give up after a day of trying to connect.
But If persistent_peers_max_dial_period is set greater than zero,
pause between each dial to each persistent peer will not exceed persistent_peers_max_dial_period
during exponential backoff and we keep trying again without giving up
Note: If seeds and persistent_peers intersect,
the user will be warned that seeds may auto-close connections
and that the node may not be able to keep the connection persistent.
Private Peers
--p2p.private_peer_ids “id100000000000000000000000000000000,id200000000000000000000000000000000”
These are IDs of the peers that we do not add to the address book or gossip to
other peers. They stay private to us.
Unconditional Peers
--p2p.unconditional_peer_ids “id100000000000000000000000000000000,id200000000000000000000000000000000”
These are IDs of the peers which are allowed to be connected by both inbound or outbound regardless of
max_num_inbound_peers or max_num_outbound_peers of user’s node reached or not.