aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/server_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-05-01 00:32:48 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-05-01 00:32:48 +0800
commit413ace37d3ba13a551f60e4089f2e0070c607970 (patch)
tree994c0dd7d0720dd771571b3ed056e99cf02fc1f1 /p2p/server_test.go
parent701591b403a8bae8c1dfb648a49d587968ff0c6a (diff)
downloaddexon-413ace37d3ba13a551f60e4089f2e0070c607970.tar
dexon-413ace37d3ba13a551f60e4089f2e0070c607970.tar.gz
dexon-413ace37d3ba13a551f60e4089f2e0070c607970.tar.bz2
dexon-413ace37d3ba13a551f60e4089f2e0070c607970.tar.lz
dexon-413ace37d3ba13a551f60e4089f2e0070c607970.tar.xz
dexon-413ace37d3ba13a551f60e4089f2e0070c607970.tar.zst
dexon-413ace37d3ba13a551f60e4089f2e0070c607970.zip
eth, p2p: rename trusted nodes to static, drop inbound extra slots
Diffstat (limited to 'p2p/server_test.go')
-rw-r--r--p2p/server_test.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/p2p/server_test.go b/p2p/server_test.go
index 3e3fd6cc0..b48361235 100644
--- a/p2p/server_test.go
+++ b/p2p/server_test.go
@@ -22,7 +22,7 @@ func startTestServer(t *testing.T, pf newPeerHook) *Server {
ListenAddr: "127.0.0.1:0",
PrivateKey: newkey(),
newPeerHook: pf,
- setupFunc: func(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake, dial *discover.Node, atcap bool, trust map[discover.NodeID]bool) (*conn, error) {
+ setupFunc: func(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake, dial *discover.Node, atcap bool) (*conn, error) {
id := randomID()
rw := newRlpxFrameRW(fd, secrets{
MAC: zero16,
@@ -102,7 +102,7 @@ func TestServerDial(t *testing.T) {
// tell the server to connect
tcpAddr := listener.Addr().(*net.TCPAddr)
- srv.trustDial <- &discover.Node{IP: tcpAddr.IP, TCPPort: tcpAddr.Port}
+ srv.staticDial <- &discover.Node{IP: tcpAddr.IP, TCPPort: tcpAddr.Port}
select {
case conn := <-accepted:
@@ -200,7 +200,7 @@ func TestServerDisconnectAtCap(t *testing.T) {
// Run the handshakes just like a real peer would.
key := newkey()
hs := &protoHandshake{Version: baseProtocolVersion, ID: discover.PubkeyID(&key.PublicKey)}
- _, err = setupConn(conn, key, hs, srv.Self(), false, nil)
+ _, err = setupConn(conn, key, hs, srv.Self(), false)
if i == nconns-1 {
// When handling the last connection, the server should
// disconnect immediately instead of running the protocol
@@ -219,6 +219,7 @@ func TestServerDisconnectAtCap(t *testing.T) {
}
}
+/*
// Tests that trusted peers and can connect above max peer caps.
func TestServerTrustedPeers(t *testing.T) {
defer testlog(t).detach()
@@ -250,7 +251,7 @@ func TestServerTrustedPeers(t *testing.T) {
// Run the handshakes just like a real peer would, and wait for completion
key := newkey()
shake := &protoHandshake{Version: baseProtocolVersion, ID: discover.PubkeyID(&key.PublicKey)}
- if _, err = setupConn(conn, key, shake, server.Self(), false, nil); err != nil {
+ if _, err = setupConn(conn, key, shake, server.Self(), false); err != nil {
t.Fatalf("conn %d: unexpected error: %v", i, err)
}
<-started
@@ -269,7 +270,7 @@ func TestServerTrustedPeers(t *testing.T) {
defer conn.Close()
shake := &protoHandshake{Version: baseProtocolVersion, ID: trusted.ID}
- if _, err = setupConn(conn, key, shake, server.Self(), false, nil); err != nil {
+ if _, err = setupConn(conn, key, shake, server.Self(), false); err != nil {
t.Fatalf("trusted node: unexpected error: %v", err)
}
select {
@@ -280,6 +281,7 @@ func TestServerTrustedPeers(t *testing.T) {
t.Fatalf("trusted node timeout")
}
}
+*/
func newkey() *ecdsa.PrivateKey {
key, err := crypto.GenerateKey()