From 95eb97f1377072fbc7a266972962d635b6627fd2 Mon Sep 17 00:00:00 2001 From: Matthew Halpern Date: Thu, 14 Feb 2019 11:12:42 -0800 Subject: [PATCH] swarm/network: extract no light node local variable to constant --- swarm/network/protocol_test.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/swarm/network/protocol_test.go b/swarm/network/protocol_test.go index 64ce7ba4ab..4869f04359 100644 --- a/swarm/network/protocol_test.go +++ b/swarm/network/protocol_test.go @@ -33,6 +33,8 @@ import ( const ( TestProtocolVersion = 8 TestProtocolNetworkID = 3 + + noLightNode = false ) var ( @@ -164,13 +166,12 @@ func correctBzzHandshake(addr *BzzAddr, lightNode bool) *HandshakeMsg { } func TestBzzHandshakeNetworkIDMismatch(t *testing.T) { - lightNode := false addr := RandomAddr() - s := newBzzHandshakeTester(1, addr, lightNode) + s := newBzzHandshakeTester(1, addr, noLightNode) node := s.Nodes[0] err := s.testHandshake( - correctBzzHandshake(addr, lightNode), + correctBzzHandshake(addr, noLightNode), &HandshakeMsg{Version: TestProtocolVersion, NetworkID: 321, Addr: NewAddr(node)}, &p2ptest.Disconnect{Peer: node.ID(), Error: fmt.Errorf("Handshake error: Message handler error: (msg code 0): network id mismatch 321 (!= 3)")}, ) @@ -181,13 +182,12 @@ func TestBzzHandshakeNetworkIDMismatch(t *testing.T) { } func TestBzzHandshakeVersionMismatch(t *testing.T) { - lightNode := false addr := RandomAddr() - s := newBzzHandshakeTester(1, addr, lightNode) + s := newBzzHandshakeTester(1, addr, noLightNode) node := s.Nodes[0] err := s.testHandshake( - correctBzzHandshake(addr, lightNode), + correctBzzHandshake(addr, noLightNode), &HandshakeMsg{Version: 0, NetworkID: TestProtocolNetworkID, Addr: NewAddr(node)}, &p2ptest.Disconnect{Peer: node.ID(), Error: fmt.Errorf("Handshake error: Message handler error: (msg code 0): version mismatch 0 (!= %d)", TestProtocolVersion)}, ) @@ -198,13 +198,12 @@ func TestBzzHandshakeVersionMismatch(t *testing.T) { } func TestBzzHandshakeSuccess(t *testing.T) { - lightNode := false addr := RandomAddr() - s := newBzzHandshakeTester(1, addr, lightNode) + s := newBzzHandshakeTester(1, addr, noLightNode) node := s.Nodes[0] err := s.testHandshake( - correctBzzHandshake(addr, lightNode), + correctBzzHandshake(addr, noLightNode), &HandshakeMsg{Version: TestProtocolVersion, NetworkID: TestProtocolNetworkID, Addr: NewAddr(node)}, )