Browse Source

SkipDuplicate -> AllowDuplicate; fix p2p test on mac

pull/1650/head
Ethan Buchman 7 years ago
parent
commit
d454b1b25f
5 changed files with 12 additions and 6 deletions
  1. +4
    -0
      CHANGELOG.md
  2. +3
    -2
      config/config.go
  3. +1
    -1
      p2p/pex/pex_reactor_test.go
  4. +1
    -1
      p2p/switch.go
  5. +3
    -2
      p2p/switch_test.go

+ 4
- 0
CHANGELOG.md View File

@ -10,12 +10,16 @@ BREAKING:
FEATURES
- [rpc] the RPC documentation is now published to https://tendermint.github.io/slate
- [p2p] AllowDuplicateIP config option to refuse connections from same IP.
- true by default for now, false by default in next breaking release
- [docs] Add docs for query, tx indexing, events, pubsub
IMPROVEMENTS:
- [consensus] consensus reactor now receives events from a separate event bus,
which is not dependant on external RPC load
- [consensus/wal] do not look for height in older files if we've seen height - 1
- [docs] Various cleanup and link fixes
## 0.19.6


+ 3
- 2
config/config.go View File

@ -294,7 +294,7 @@ type P2PConfig struct {
PrivatePeerIDs string `mapstructure:"private_peer_ids"`
// Toggle to disable guard against peers connecting from the same ip.
SkipDuplicatePeerIPCheck bool `mapstructure:"skip_duplicate_peer_ip_check"`
AllowDuplicateIP bool `mapstructure:"allow_duplicate_ip"`
}
// DefaultP2PConfig returns a default configuration for the peer-to-peer layer
@ -311,6 +311,7 @@ func DefaultP2PConfig() *P2PConfig {
PexReactor: true,
SeedMode: false,
AuthEnc: true,
AllowDuplicateIP: true, // so non-breaking yet
}
}
@ -320,7 +321,7 @@ func TestP2PConfig() *P2PConfig {
cfg.ListenAddress = "tcp://0.0.0.0:36656"
cfg.SkipUPNP = true
cfg.FlushThrottleTimeout = 10
cfg.SkipDuplicatePeerIPCheck = true
cfg.AllowDuplicateIP = true
return cfg
}


+ 1
- 1
p2p/pex/pex_reactor_test.go View File

@ -27,7 +27,7 @@ var (
func init() {
config = cfg.DefaultP2PConfig()
config.PexReactor = true
config.SkipDuplicatePeerIPCheck = true
config.AllowDuplicateIP = true
}
func TestPEXReactorBasic(t *testing.T) {


+ 1
- 1
p2p/switch.go View File

@ -577,7 +577,7 @@ func (sw *Switch) addPeer(pc peerConn) error {
}
// Check for duplicate connection or peer info IP.
if !sw.config.SkipDuplicatePeerIPCheck &&
if !sw.config.AllowDuplicateIP &&
(sw.peers.HasIP(pc.RemoteIP()) ||
sw.peers.HasIP(peerNodeInfo.NetAddress().IP)) {
return ErrSwitchDuplicatePeerIP{pc.RemoteIP()}


+ 3
- 2
p2p/switch_test.go View File

@ -25,6 +25,7 @@ var (
func init() {
config = cfg.DefaultP2PConfig()
config.PexReactor = true
config.AllowDuplicateIP = true
}
type PeerMessage struct {
@ -180,7 +181,7 @@ func TestConnAddrFilter(t *testing.T) {
}
func TestSwitchFiltersOutItself(t *testing.T) {
s1 := MakeSwitch(config, 1, "127.0.0.2", "123.123.123", initSwitchFunc)
s1 := MakeSwitch(config, 1, "127.0.0.1", "123.123.123", initSwitchFunc)
// addr := s1.NodeInfo().NetAddress()
// // add ourselves like we do in node.go#427
@ -322,7 +323,7 @@ func TestSwitchReconnectsToPersistentPeer(t *testing.T) {
Config: DefaultPeerConfig(),
// Use different interface to prevent duplicate IP filter, this will break
// beyond two peers.
listenAddr: "127.0.0.2:0",
listenAddr: "127.0.0.1:0",
}
rp.Start()
defer rp.Stop()


Loading…
Cancel
Save