mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-02 19:44:03 +02:00
lnwire: refactor Encode to use specific writers - II
This commit takes another 10 message types and refactors their Encode method to use specific writers. The following commit will refactor the rest.
This commit is contained in:
@ -60,12 +60,19 @@ func (q *QueryChannelRange) Decode(r io.Reader, pver uint32) error {
|
||||
//
|
||||
// This is part of the lnwire.Message interface.
|
||||
func (q *QueryChannelRange) Encode(w *bytes.Buffer, pver uint32) error {
|
||||
return WriteElements(w,
|
||||
q.ChainHash[:],
|
||||
q.FirstBlockHeight,
|
||||
q.NumBlocks,
|
||||
q.ExtraData,
|
||||
)
|
||||
if err := WriteBytes(w, q.ChainHash[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := WriteUint32(w, q.FirstBlockHeight); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := WriteUint32(w, q.NumBlocks); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return WriteBytes(w, q.ExtraData)
|
||||
}
|
||||
|
||||
// MsgType returns the integer uniquely identifying this message type on the
|
||||
|
Reference in New Issue
Block a user