Merge
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/big"
|
||||
@ -49,7 +50,14 @@ func encodePayload(params ...interface{}) []byte {
|
||||
// For the decoding rules, please see package rlp.
|
||||
func (msg Msg) Decode(val interface{}) error {
|
||||
s := rlp.NewListStream(msg.Payload, uint64(msg.Size))
|
||||
return s.Decode(val)
|
||||
if err := s.Decode(val); err != nil {
|
||||
return newPeerError(errInvalidMsg, "(code %#x) (size %d) %v", msg.Code, msg.Size, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (msg Msg) String() string {
|
||||
return fmt.Sprintf("msg #%v (%v bytes)", msg.Code, msg.Size)
|
||||
}
|
||||
|
||||
// Discard reads any remaining payload data into a black hole.
|
||||
|
Reference in New Issue
Block a user