aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/message.go
diff options
context:
space:
mode:
authorGagziW <leon.stanko@rwth-aachen.de>2018-05-03 16:33:39 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-05-03 16:33:39 +0800
commitf2447bd4c35573d40e2ef678809657c5a1d4e999 (patch)
tree86126938eca5086daa6f226007f740081a59fee1 /p2p/message.go
parentea1724de1a158968aec732a557d3d688c4799887 (diff)
downloadgo-tangerine-f2447bd4c35573d40e2ef678809657c5a1d4e999.tar
go-tangerine-f2447bd4c35573d40e2ef678809657c5a1d4e999.tar.gz
go-tangerine-f2447bd4c35573d40e2ef678809657c5a1d4e999.tar.bz2
go-tangerine-f2447bd4c35573d40e2ef678809657c5a1d4e999.tar.lz
go-tangerine-f2447bd4c35573d40e2ef678809657c5a1d4e999.tar.xz
go-tangerine-f2447bd4c35573d40e2ef678809657c5a1d4e999.tar.zst
go-tangerine-f2447bd4c35573d40e2ef678809657c5a1d4e999.zip
p2p: changed if-else blocks to conform with golint (#16660)
Diffstat (limited to 'p2p/message.go')
-rw-r--r--p2p/message.go29
1 files changed, 14 insertions, 15 deletions
diff --git a/p2p/message.go b/p2p/message.go
index 50b419970..ffa2ef86a 100644
--- a/p2p/message.go
+++ b/p2p/message.go
@@ -229,21 +229,20 @@ func ExpectMsg(r MsgReader, code uint64, content interface{}) error {
}
if content == nil {
return msg.Discard()
- } else {
- contentEnc, err := rlp.EncodeToBytes(content)
- if err != nil {
- panic("content encode error: " + err.Error())
- }
- if int(msg.Size) != len(contentEnc) {
- return fmt.Errorf("message size mismatch: got %d, want %d", msg.Size, len(contentEnc))
- }
- actualContent, err := ioutil.ReadAll(msg.Payload)
- if err != nil {
- return err
- }
- if !bytes.Equal(actualContent, contentEnc) {
- return fmt.Errorf("message payload mismatch:\ngot: %x\nwant: %x", actualContent, contentEnc)
- }
+ }
+ contentEnc, err := rlp.EncodeToBytes(content)
+ if err != nil {
+ panic("content encode error: " + err.Error())
+ }
+ if int(msg.Size) != len(contentEnc) {
+ return fmt.Errorf("message size mismatch: got %d, want %d", msg.Size, len(contentEnc))
+ }
+ actualContent, err := ioutil.ReadAll(msg.Payload)
+ if err != nil {
+ return err
+ }
+ if !bytes.Equal(actualContent, contentEnc) {
+ return fmt.Errorf("message payload mismatch:\ngot: %x\nwant: %x", actualContent, contentEnc)
}
return nil
}