Skip to content

Commit

Permalink
go/consensus/tendermint: support CfgP2PPersistenPeersMaxDialPeriod
Browse files Browse the repository at this point in the history
Tendermint 0.33 added support for setting maximum re-dial period when
dialing persistent peers. This adds support for setting the period via
`tendermint.p2p.persistent_peers_max_dial_period` flag.
  • Loading branch information
ptrus committed Apr 20, 2020
1 parent aa99aa6 commit 24eb89f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .changelog/2855.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
go/consensus/tendermint: Expose new config options added in Tendermint 0.33

Tendermint 0.33 added the concept of unconditional P2P peers. Support for
setting the unconditional peers via `tendermint.p2p.unconditional_peer_ids`
configuration flag is added. On sentry node, upstream nodes will automatically
be set as unconditional peers.

Tendermint 0.33 added support for setting maximum re-dial period when
dialing persistent peers. This adds support for setting the period via
`tendermint.p2p.persistent_peers_max_dial_period` flag.
4 changes: 4 additions & 0 deletions go/consensus/tendermint/tendermint.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ const (

// CfgP2PPersistentPeer configures tendermint's persistent peer(s).
CfgP2PPersistentPeer = "tendermint.p2p.persistent_peer"
// CfgP2PPersistenPeersMaxDialPeriod configures the tendermint's peristent peer max dial period.
CfgP2PPersistenPeersMaxDialPeriod = "tendermint.p2p.persistent_peers_max_dial_period"
// CfgP2PDisablePeerExchange disables tendermint's peer-exchange (Pex) reactor.
CfgP2PDisablePeerExchange = "tendermint.p2p.disable_peer_exchange"
// CfgP2PSeeds configures tendermint's seed node(s).
Expand Down Expand Up @@ -962,6 +964,7 @@ func (t *tendermintService) lazyInit() error {
// Since persistent peers is expected to be in comma-delimited ID@host:port format,
// lowercasing the whole string is ok.
tenderConfig.P2P.PersistentPeers = strings.ToLower(strings.Join(viper.GetStringSlice(CfgP2PPersistentPeer), ","))
tenderConfig.P2P.PersistentPeersMaxDialPeriod = viper.GetDuration(CfgP2PPersistenPeersMaxDialPeriod)
// Unconditional peer IDs need to be lowercase as p2p/transport.go:MultiplexTransport.upgrade()
// uses a case sensitive string comparision to validate public keys.
// Since persistent peers is expected to be in comma-delimited ID format,
Expand Down Expand Up @@ -1386,6 +1389,7 @@ func init() {
Flags.StringSlice(CfgP2PUnconditionalPeerIDs, []string{}, "Tendermint unconditional peer IDs")
Flags.Bool(CfgP2PDisablePeerExchange, false, "Disable Tendermint's peer-exchange reactor")
Flags.Bool(CfgP2PSeedMode, false, "run the tendermint node in seed mode")
Flags.Duration(CfgP2PPersistenPeersMaxDialPeriod, 0*time.Second, "Tendermint max timeout when redialing a persistent peer (default: unlimited).")
Flags.Int(CfgP2PMaxNumInboundPeers, 40, "Max number of inbound peers")
Flags.Int(CfgP2PMaxNumOutboundPeers, 20, "Max number of outbound peers (excluding persistent peers)")
Flags.Int64(CfgP2PSendRate, 5120000, "Rate at which packets can be sent (bytes/sec)")
Expand Down

0 comments on commit 24eb89f

Please sign in to comment.