wire/msgpong: remove usage of read/writeElement

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

View File

@ -31,7 +31,13 @@ func (msg *MsgPong) BtcDecode(r io.Reader, pver uint32, enc MessageEncoding) err
return messageError("MsgPong.BtcDecode", str)
}
return readElement(r, &msg.Nonce)
nonce, err := binarySerializer.Uint64(r, littleEndian)
if err != nil {
return err
}
msg.Nonce = nonce
return nil
}
// BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
@ -45,7 +51,7 @@ func (msg *MsgPong) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) err
return messageError("MsgPong.BtcEncode", str)
}
return writeElement(w, msg.Nonce)
return binarySerializer.PutUint64(w, littleEndian, msg.Nonce)
}
// Command returns the protocol command string for the message. This is part