mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-31 20:21:56 +00:00
revert removing private peers from persistent
This commit is contained in:
@@ -251,6 +251,7 @@ type P2PConfig struct {
|
|||||||
Seeds string `mapstructure:"seeds"`
|
Seeds string `mapstructure:"seeds"`
|
||||||
|
|
||||||
// Comma separated list of nodes to keep persistent connections to
|
// Comma separated list of nodes to keep persistent connections to
|
||||||
|
// Do not add private peers to this list if you don't want them advertised
|
||||||
PersistentPeers string `mapstructure:"persistent_peers"`
|
PersistentPeers string `mapstructure:"persistent_peers"`
|
||||||
|
|
||||||
// Skip UPNP port forwarding
|
// Skip UPNP port forwarding
|
||||||
|
@@ -127,6 +127,7 @@ laddr = "{{ .P2P.ListenAddress }}"
|
|||||||
seeds = ""
|
seeds = ""
|
||||||
|
|
||||||
# Comma separated list of nodes to keep persistent connections to
|
# Comma separated list of nodes to keep persistent connections to
|
||||||
|
# Do not add private peers to this list if you don't want them advertised
|
||||||
persistent_peers = ""
|
persistent_peers = ""
|
||||||
|
|
||||||
# Path to address book
|
# Path to address book
|
||||||
|
@@ -89,6 +89,7 @@ like the file below, however, double check by inspecting the
|
|||||||
seeds = ""
|
seeds = ""
|
||||||
|
|
||||||
# Comma separated list of nodes to keep persistent connections to
|
# Comma separated list of nodes to keep persistent connections to
|
||||||
|
# Do not add private peers to this list if you don't want them advertised
|
||||||
persistent_peers = ""
|
persistent_peers = ""
|
||||||
|
|
||||||
# Path to address book
|
# Path to address book
|
||||||
|
31
node/node.go
31
node/node.go
@@ -422,39 +422,10 @@ func (n *Node) OnStart() error {
|
|||||||
|
|
||||||
// Always connect to persistent peers
|
// Always connect to persistent peers
|
||||||
if n.config.P2P.PersistentPeers != "" {
|
if n.config.P2P.PersistentPeers != "" {
|
||||||
// are any of the persistent peers private?
|
err = n.sw.DialPeersAsync(n.addrBook, strings.Split(n.config.P2P.PersistentPeers, ","), true)
|
||||||
persistentPeers := []string{}
|
|
||||||
persistentAndPrivatePeers := []string{}
|
|
||||||
var privatePeerIDs []string
|
|
||||||
if n.config.P2P.PrivatePeerIDs != "" {
|
|
||||||
privatePeerIDs = strings.Split(n.config.P2P.PrivatePeerIDs, ",")
|
|
||||||
}
|
|
||||||
PP_LOOP:
|
|
||||||
for _, peer := range strings.Split(n.config.P2P.PersistentPeers, ",") {
|
|
||||||
spl := strings.Split(peer, "@")
|
|
||||||
if len(spl) == 2 {
|
|
||||||
for _, ppID := range privatePeerIDs {
|
|
||||||
if spl[0] == ppID {
|
|
||||||
persistentAndPrivatePeers = append(persistentAndPrivatePeers, peer)
|
|
||||||
continue PP_LOOP
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
persistentPeers = append(persistentPeers, peer)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = n.sw.DialPeersAsync(n.addrBook, persistentPeers, true)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// if any of the persistent peers are private, do not add them to addrbook
|
|
||||||
if len(persistentAndPrivatePeers) > 0 {
|
|
||||||
err = n.sw.DialPeersAsync(nil, persistentAndPrivatePeers, true)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// start tx indexer
|
// start tx indexer
|
||||||
|
Reference in New Issue
Block a user