Remove dead error check in WriteMessage.
The io.Writer.Write function always returns an error if the bytes written is less than provided, so there is no reason to further check if the payload length matches after a successful write.
This commit is contained in:
parent
7385f6ff24
commit
0400d0cec3
1 changed files with 1 additions and 6 deletions
|
@ -196,15 +196,10 @@ func WriteMessage(w io.Writer, msg Message, pver uint32, btcnet BitcoinNet) erro
|
|||
}
|
||||
|
||||
// Write payload.
|
||||
n, err := w.Write(payload)
|
||||
_, err = w.Write(payload)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if n != lenp {
|
||||
str := fmt.Sprintf("failed to write payload - wrote %v bytes, "+
|
||||
"payload size is %v bytes", n, lenp)
|
||||
return messageError("WriteMessage", str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue