mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-06 21:36:26 +00:00
p2p: add unconditional_peer_ids and persistent_peers_max_dial_period (#4176)
implementation spec of Improved Trusted Peering ADR-050 by B-Harvest - add unconditional_peer_ids and persistent_peers_max_dial_period to config - add unconditionalPeerIDs map to Switch struct default config value of persistent_peers_max_dial_period is 0s(disabled) Refs #4072, #4053
This commit is contained in:
@@ -541,7 +541,8 @@ func createPEXReactorAndAddToSwitch(addrBook pex.AddrBook, config *cfg.Config,
|
||||
// TODO (melekes): make it dynamic based on the actual block latencies
|
||||
// from the live network.
|
||||
// https://github.com/tendermint/tendermint/issues/3523
|
||||
SeedDisconnectWaitPeriod: 28 * time.Hour,
|
||||
SeedDisconnectWaitPeriod: 28 * time.Hour,
|
||||
PersistentPeersMaxDialPeriod: config.P2P.PersistentPeersMaxDialPeriod,
|
||||
})
|
||||
pexReactor.SetLogger(logger.With("module", "pex"))
|
||||
sw.AddReactor("PEX", pexReactor)
|
||||
@@ -677,6 +678,11 @@ func NewNode(config *cfg.Config,
|
||||
return nil, errors.Wrap(err, "could not add peers from persistent_peers field")
|
||||
}
|
||||
|
||||
err = sw.AddUnconditionalPeerIDs(splitAndTrimEmpty(config.P2P.UnconditionalPeerIDs, ",", " "))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not add peer ids from unconditional_peer_ids field")
|
||||
}
|
||||
|
||||
addrBook, err := createAddrBookAndSetOnSwitch(config, sw, p2pLogger, nodeKey)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not create addrbook")
|
||||
|
||||
Reference in New Issue
Block a user