aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2018-02-22 18:37:57 +0800
committerFelix Lange <fjl@twurst.com>2018-02-22 18:37:57 +0800
commit28b20cff4b76595b695f9d784c98d50d31bb269b (patch)
treed7550fe9d081f103b60a563e1545bc7a6dde7e2b /p2p
parente07603bbc4d474667a0e724e9baefd8b7c330a61 (diff)
downloaddexon-28b20cff4b76595b695f9d784c98d50d31bb269b.tar
dexon-28b20cff4b76595b695f9d784c98d50d31bb269b.tar.gz
dexon-28b20cff4b76595b695f9d784c98d50d31bb269b.tar.bz2
dexon-28b20cff4b76595b695f9d784c98d50d31bb269b.tar.lz
dexon-28b20cff4b76595b695f9d784c98d50d31bb269b.tar.xz
dexon-28b20cff4b76595b695f9d784c98d50d31bb269b.tar.zst
dexon-28b20cff4b76595b695f9d784c98d50d31bb269b.zip
p2p/protocols: gofmt -w -s
Diffstat (limited to 'p2p')
-rw-r--r--p2p/protocols/protocol_test.go44
1 files changed, 22 insertions, 22 deletions
diff --git a/p2p/protocols/protocol_test.go b/p2p/protocols/protocol_test.go
index b041a650a..053f537a6 100644
--- a/p2p/protocols/protocol_test.go
+++ b/p2p/protocols/protocol_test.go
@@ -147,18 +147,18 @@ func protocolTester(t *testing.T, pp *p2ptest.TestPeerPool) *p2ptest.ProtocolTes
func protoHandshakeExchange(id discover.NodeID, proto *protoHandshake) []p2ptest.Exchange {
return []p2ptest.Exchange{
- p2ptest.Exchange{
+ {
Expects: []p2ptest.Expect{
- p2ptest.Expect{
+ {
Code: 0,
Msg: &protoHandshake{42, "420"},
Peer: id,
},
},
},
- p2ptest.Exchange{
+ {
Triggers: []p2ptest.Trigger{
- p2ptest.Trigger{
+ {
Code: 0,
Msg: proto,
Peer: id,
@@ -200,18 +200,18 @@ func TestProtoHandshakeSuccess(t *testing.T) {
func moduleHandshakeExchange(id discover.NodeID, resp uint) []p2ptest.Exchange {
return []p2ptest.Exchange{
- p2ptest.Exchange{
+ {
Expects: []p2ptest.Expect{
- p2ptest.Expect{
+ {
Code: 1,
Msg: &hs0{42},
Peer: id,
},
},
},
- p2ptest.Exchange{
+ {
Triggers: []p2ptest.Trigger{
- p2ptest.Trigger{
+ {
Code: 1,
Msg: &hs0{resp},
Peer: id,
@@ -252,42 +252,42 @@ func TestModuleHandshakeSuccess(t *testing.T) {
func testMultiPeerSetup(a, b discover.NodeID) []p2ptest.Exchange {
return []p2ptest.Exchange{
- p2ptest.Exchange{
+ {
Label: "primary handshake",
Expects: []p2ptest.Expect{
- p2ptest.Expect{
+ {
Code: 0,
Msg: &protoHandshake{42, "420"},
Peer: a,
},
- p2ptest.Expect{
+ {
Code: 0,
Msg: &protoHandshake{42, "420"},
Peer: b,
},
},
},
- p2ptest.Exchange{
+ {
Label: "module handshake",
Triggers: []p2ptest.Trigger{
- p2ptest.Trigger{
+ {
Code: 0,
Msg: &protoHandshake{42, "420"},
Peer: a,
},
- p2ptest.Trigger{
+ {
Code: 0,
Msg: &protoHandshake{42, "420"},
Peer: b,
},
},
Expects: []p2ptest.Expect{
- p2ptest.Expect{
+ {
Code: 1,
Msg: &hs0{42},
Peer: a,
},
- p2ptest.Expect{
+ {
Code: 1,
Msg: &hs0{42},
Peer: b,
@@ -295,10 +295,10 @@ func testMultiPeerSetup(a, b discover.NodeID) []p2ptest.Exchange {
},
},
- p2ptest.Exchange{Label: "alternative module handshake", Triggers: []p2ptest.Trigger{p2ptest.Trigger{Code: 1, Msg: &hs0{41}, Peer: a},
- p2ptest.Trigger{Code: 1, Msg: &hs0{41}, Peer: b}}},
- p2ptest.Exchange{Label: "repeated module handshake", Triggers: []p2ptest.Trigger{p2ptest.Trigger{Code: 1, Msg: &hs0{1}, Peer: a}}},
- p2ptest.Exchange{Label: "receiving repeated module handshake", Expects: []p2ptest.Expect{p2ptest.Expect{Code: 1, Msg: &hs0{43}, Peer: a}}}}
+ {Label: "alternative module handshake", Triggers: []p2ptest.Trigger{{Code: 1, Msg: &hs0{41}, Peer: a},
+ {Code: 1, Msg: &hs0{41}, Peer: b}}},
+ {Label: "repeated module handshake", Triggers: []p2ptest.Trigger{{Code: 1, Msg: &hs0{1}, Peer: a}}},
+ {Label: "receiving repeated module handshake", Expects: []p2ptest.Expect{{Code: 1, Msg: &hs0{43}, Peer: a}}}}
}
func runMultiplePeers(t *testing.T, peer int, errs ...error) {
@@ -332,7 +332,7 @@ WAIT:
// peer 0 sends kill request for peer with index <peer>
err := s.TestExchanges(p2ptest.Exchange{
Triggers: []p2ptest.Trigger{
- p2ptest.Trigger{
+ {
Code: 2,
Msg: &kill{s.IDs[peer]},
Peer: s.IDs[0],
@@ -347,7 +347,7 @@ WAIT:
// the peer not killed sends a drop request
err = s.TestExchanges(p2ptest.Exchange{
Triggers: []p2ptest.Trigger{
- p2ptest.Trigger{
+ {
Code: 3,
Msg: &drop{},
Peer: s.IDs[(peer+1)%2],