forked from cerc-io/plugeth
p2p/protocols: gofmt -w -s
This commit is contained in:
parent
e07603bbc4
commit
28b20cff4b
@ -147,18 +147,18 @@ func protocolTester(t *testing.T, pp *p2ptest.TestPeerPool) *p2ptest.ProtocolTes
|
|||||||
func protoHandshakeExchange(id discover.NodeID, proto *protoHandshake) []p2ptest.Exchange {
|
func protoHandshakeExchange(id discover.NodeID, proto *protoHandshake) []p2ptest.Exchange {
|
||||||
|
|
||||||
return []p2ptest.Exchange{
|
return []p2ptest.Exchange{
|
||||||
p2ptest.Exchange{
|
{
|
||||||
Expects: []p2ptest.Expect{
|
Expects: []p2ptest.Expect{
|
||||||
p2ptest.Expect{
|
{
|
||||||
Code: 0,
|
Code: 0,
|
||||||
Msg: &protoHandshake{42, "420"},
|
Msg: &protoHandshake{42, "420"},
|
||||||
Peer: id,
|
Peer: id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
p2ptest.Exchange{
|
{
|
||||||
Triggers: []p2ptest.Trigger{
|
Triggers: []p2ptest.Trigger{
|
||||||
p2ptest.Trigger{
|
{
|
||||||
Code: 0,
|
Code: 0,
|
||||||
Msg: proto,
|
Msg: proto,
|
||||||
Peer: id,
|
Peer: id,
|
||||||
@ -200,18 +200,18 @@ func TestProtoHandshakeSuccess(t *testing.T) {
|
|||||||
func moduleHandshakeExchange(id discover.NodeID, resp uint) []p2ptest.Exchange {
|
func moduleHandshakeExchange(id discover.NodeID, resp uint) []p2ptest.Exchange {
|
||||||
|
|
||||||
return []p2ptest.Exchange{
|
return []p2ptest.Exchange{
|
||||||
p2ptest.Exchange{
|
{
|
||||||
Expects: []p2ptest.Expect{
|
Expects: []p2ptest.Expect{
|
||||||
p2ptest.Expect{
|
{
|
||||||
Code: 1,
|
Code: 1,
|
||||||
Msg: &hs0{42},
|
Msg: &hs0{42},
|
||||||
Peer: id,
|
Peer: id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
p2ptest.Exchange{
|
{
|
||||||
Triggers: []p2ptest.Trigger{
|
Triggers: []p2ptest.Trigger{
|
||||||
p2ptest.Trigger{
|
{
|
||||||
Code: 1,
|
Code: 1,
|
||||||
Msg: &hs0{resp},
|
Msg: &hs0{resp},
|
||||||
Peer: id,
|
Peer: id,
|
||||||
@ -252,42 +252,42 @@ func TestModuleHandshakeSuccess(t *testing.T) {
|
|||||||
func testMultiPeerSetup(a, b discover.NodeID) []p2ptest.Exchange {
|
func testMultiPeerSetup(a, b discover.NodeID) []p2ptest.Exchange {
|
||||||
|
|
||||||
return []p2ptest.Exchange{
|
return []p2ptest.Exchange{
|
||||||
p2ptest.Exchange{
|
{
|
||||||
Label: "primary handshake",
|
Label: "primary handshake",
|
||||||
Expects: []p2ptest.Expect{
|
Expects: []p2ptest.Expect{
|
||||||
p2ptest.Expect{
|
{
|
||||||
Code: 0,
|
Code: 0,
|
||||||
Msg: &protoHandshake{42, "420"},
|
Msg: &protoHandshake{42, "420"},
|
||||||
Peer: a,
|
Peer: a,
|
||||||
},
|
},
|
||||||
p2ptest.Expect{
|
{
|
||||||
Code: 0,
|
Code: 0,
|
||||||
Msg: &protoHandshake{42, "420"},
|
Msg: &protoHandshake{42, "420"},
|
||||||
Peer: b,
|
Peer: b,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
p2ptest.Exchange{
|
{
|
||||||
Label: "module handshake",
|
Label: "module handshake",
|
||||||
Triggers: []p2ptest.Trigger{
|
Triggers: []p2ptest.Trigger{
|
||||||
p2ptest.Trigger{
|
{
|
||||||
Code: 0,
|
Code: 0,
|
||||||
Msg: &protoHandshake{42, "420"},
|
Msg: &protoHandshake{42, "420"},
|
||||||
Peer: a,
|
Peer: a,
|
||||||
},
|
},
|
||||||
p2ptest.Trigger{
|
{
|
||||||
Code: 0,
|
Code: 0,
|
||||||
Msg: &protoHandshake{42, "420"},
|
Msg: &protoHandshake{42, "420"},
|
||||||
Peer: b,
|
Peer: b,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Expects: []p2ptest.Expect{
|
Expects: []p2ptest.Expect{
|
||||||
p2ptest.Expect{
|
{
|
||||||
Code: 1,
|
Code: 1,
|
||||||
Msg: &hs0{42},
|
Msg: &hs0{42},
|
||||||
Peer: a,
|
Peer: a,
|
||||||
},
|
},
|
||||||
p2ptest.Expect{
|
{
|
||||||
Code: 1,
|
Code: 1,
|
||||||
Msg: &hs0{42},
|
Msg: &hs0{42},
|
||||||
Peer: b,
|
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},
|
{Label: "alternative module handshake", Triggers: []p2ptest.Trigger{{Code: 1, Msg: &hs0{41}, Peer: a},
|
||||||
p2ptest.Trigger{Code: 1, Msg: &hs0{41}, Peer: b}}},
|
{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}}},
|
{Label: "repeated module handshake", Triggers: []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: "receiving repeated module handshake", Expects: []p2ptest.Expect{{Code: 1, Msg: &hs0{43}, Peer: a}}}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func runMultiplePeers(t *testing.T, peer int, errs ...error) {
|
func runMultiplePeers(t *testing.T, peer int, errs ...error) {
|
||||||
@ -332,7 +332,7 @@ WAIT:
|
|||||||
// peer 0 sends kill request for peer with index <peer>
|
// peer 0 sends kill request for peer with index <peer>
|
||||||
err := s.TestExchanges(p2ptest.Exchange{
|
err := s.TestExchanges(p2ptest.Exchange{
|
||||||
Triggers: []p2ptest.Trigger{
|
Triggers: []p2ptest.Trigger{
|
||||||
p2ptest.Trigger{
|
{
|
||||||
Code: 2,
|
Code: 2,
|
||||||
Msg: &kill{s.IDs[peer]},
|
Msg: &kill{s.IDs[peer]},
|
||||||
Peer: s.IDs[0],
|
Peer: s.IDs[0],
|
||||||
@ -347,7 +347,7 @@ WAIT:
|
|||||||
// the peer not killed sends a drop request
|
// the peer not killed sends a drop request
|
||||||
err = s.TestExchanges(p2ptest.Exchange{
|
err = s.TestExchanges(p2ptest.Exchange{
|
||||||
Triggers: []p2ptest.Trigger{
|
Triggers: []p2ptest.Trigger{
|
||||||
p2ptest.Trigger{
|
{
|
||||||
Code: 3,
|
Code: 3,
|
||||||
Msg: &drop{},
|
Msg: &drop{},
|
||||||
Peer: s.IDs[(peer+1)%2],
|
Peer: s.IDs[(peer+1)%2],
|
||||||
|
Loading…
Reference in New Issue
Block a user