wire/msgping: remove usage for read/writeElement

This commit is contained in:
Conner Fromknecht 2020-01-24 19:44:57 -08:00 committed by Olaoluwa Osuntokun
parent 7207967135
commit 3698f2deab
No known key found for this signature in database
GPG Key ID: 3BBD59E99B280306

View File

@ -32,10 +32,11 @@ func (msg *MsgPing) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) err
// NOTE: > is not a mistake here. The BIP0031 was defined as AFTER
// the version unlike most others.
if pver > BIP0031Version {
err := readElement(r, &msg.Nonce)
nonce, err := binarySerializer.Uint64(r, littleEndian)
if err != nil {
return err
}
msg.Nonce = nonce
}
return nil
@ -48,7 +49,7 @@ func (msg *MsgPing) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) err
// NOTE: > is not a mistake here. The BIP0031 was defined as AFTER
// the version unlike most others.
if pver > BIP0031Version {
err := writeElement(w, msg.Nonce)
err := binarySerializer.PutUint64(w, littleEndian, msg.Nonce)
if err != nil {
return err
}