SkipDuplicate -> AllowDuplicate; fix p2p test on mac

This commit is contained in:
Ethan Buchman 2018-05-30 21:44:39 -04:00
parent 432f21452d
commit d454b1b25f
5 changed files with 12 additions and 6 deletions

View File

@ -10,12 +10,16 @@ BREAKING:
FEATURES FEATURES
- [rpc] the RPC documentation is now published to https://tendermint.github.io/slate - [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: IMPROVEMENTS:
- [consensus] consensus reactor now receives events from a separate event bus, - [consensus] consensus reactor now receives events from a separate event bus,
which is not dependant on external RPC load which is not dependant on external RPC load
- [consensus/wal] do not look for height in older files if we've seen height - 1 - [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 ## 0.19.6

View File

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

View File

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

View File

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

View File

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