lnwire: use write buffer in Encode methods
This commit changes the WriteElement and WriteElements methods to take a write buffer instead of io.Writer. The corresponding Encode methods are changed to use the write buffer.
This commit is contained in:
36 files changed
+139
-76
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package lnwire
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
@@ -150,7 +151,7 @@ var _ Message = (*OpenChannel)(nil)
|
||||
// protocol version.
|
||||
//
|
||||
// This is part of the lnwire.Message interface.
|
||||
func (o *OpenChannel) Encode(w io.Writer, pver uint32) error {
|
||||
func (o *OpenChannel) Encode(w *bytes.Buffer, pver uint32) error {
|
||||
// Since the upfront script is encoded as a TLV record, concatenate it
|
||||
// with the ExtraData, and write them as one.
|
||||
tlvRecords, err := packShutdownScript(
|
||||
|
||||
Reference in new issue
Block a user