diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 53660ff89..cb9a50082 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -17,6 +17,8 @@ Friendly reminder: We have a [bug bounty program](https://hackerone.com/tendermi - [rpc] \#6168 Change default sorting to desc for `/tx_search` results (@melekes) - [cli] \#6282 User must specify the node mode when using `tendermint init` (@cmwaters) - [state/indexer] \#6382 reconstruct indexer, move txindex into the indexer package (@JayT106) + - [cli] \#6372 Introduce `BootstrapPeers` as part of the new p2p stack. Peers to be connected on + startup (@cmwaters) - Apps - [ABCI] \#5447 Remove `SetOption` method from `ABCI.Client` interface diff --git a/UPGRADING.md b/UPGRADING.md index e9170ffab..247847085 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -21,6 +21,10 @@ This guide provides instructions for upgrading to specific versions of Tendermin * Added `--mode` flag and `mode` config variable on `config.toml` for setting Mode of the Node: `full` | `validator` | `seed` (default: `full`) [ADR-52](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-052-tendermint-mode.md) + +* `BootstrapPeers` has been added as part of the new p2p stack. This will eventually replace + `Seeds`. Bootstrap peers are connected with on startup if needed for peer discovery. Unlike + persistent peers, there's no gaurantee that the node will remain connected with these peers. ### CLI Changes diff --git a/config/config.go b/config/config.go index 5b26ad7f2..8d1a75a81 100644 --- a/config/config.go +++ b/config/config.go @@ -551,8 +551,16 @@ type P2PConfig struct { //nolint: maligned // Comma separated list of seed nodes to connect to // We only use these if we can’t connect to peers in the addrbook + // NOTE: not used by the new PEX reactor. Please use BootstrapPeers instead. + // TODO: Remove once p2p refactor is complete + // ref: https://github.com/tendermint/tendermint/issues/5670 Seeds string `mapstructure:"seeds"` + // Comma separated list of peers to be added to the peer store + // on startup. Either BootstrapPeers or PersistentPeers are + // needed for peer discovery + BootstrapPeers string `mapstructure:"bootstrap-peers"` + // Comma separated list of nodes to keep persistent connections to PersistentPeers string `mapstructure:"persistent-peers"` diff --git a/config/toml.go b/config/toml.go index eeee75242..03fe40cf1 100644 --- a/config/toml.go +++ b/config/toml.go @@ -277,8 +277,17 @@ laddr = "{{ .P2P.ListenAddress }}" external-address = "{{ .P2P.ExternalAddress }}" # Comma separated list of seed nodes to connect to +# We only use these if we can’t connect to peers in the addrbook +# NOTE: not used by the new PEX reactor. Please use BootstrapPeers instead. +# TODO: Remove once p2p refactor is complete +# ref: https:#github.com/tendermint/tendermint/issues/5670 seeds = "{{ .P2P.Seeds }}" +# Comma separated list of peers to be added to the peer store +# on startup. Either BootstrapPeers or PersistentPeers are +# needed for peer discovery +bootstrap-peers = "{{ .P2P.BootstrapPeers }}" + # Comma separated list of nodes to keep persistent connections to persistent-peers = "{{ .P2P.PersistentPeers }}" diff --git a/node/node.go b/node/node.go index 6dae62958..3c396a8b9 100644 --- a/node/node.go +++ b/node/node.go @@ -628,6 +628,14 @@ func createPeerManager( options.PersistentPeers = append(options.PersistentPeers, address.NodeID) } + for _, p := range splitAndTrimEmpty(config.P2P.BootstrapPeers, ",", " ") { + address, err := p2p.ParseNodeAddress(p) + if err != nil { + return nil, fmt.Errorf("invalid peer address %q: %w", p, err) + } + peers = append(peers, address) + } + peerDB, err := dbProvider(&DBContext{"peerstore", config}) if err != nil { return nil, err