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:
Dave Collins 2013-05-11 23:22:09 -05:00
parent 7385f6ff24
commit 0400d0cec3

View file

@ -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
}