mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 22:50:58 +02:00
lnwire: add new FundingFlag type for OpenChannel
In this commit we add a new type to the lnwire package: FundingFlag. This type will serve as an enum to describe the possible flags that can be used within the ChannelFlags field in the OpenChannel struct. We also define the first assigned flag: FFAnnounceChannel, which indicates if the initiator of the funding flow wishes to announce the channel to the greater network.
This commit is contained in:
@@ -86,6 +86,12 @@ func writeElement(w io.Writer, element interface{}) error {
|
||||
if _, err := w.Write(b[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
case FundingFlag:
|
||||
var b [1]byte
|
||||
b[0] = uint8(e)
|
||||
if _, err := w.Write(b[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
case uint16:
|
||||
var b [2]byte
|
||||
binary.BigEndian.PutUint16(b[:], e)
|
||||
@@ -388,6 +394,12 @@ func readElement(r io.Reader, element interface{}) error {
|
||||
return err
|
||||
}
|
||||
*e = b[0]
|
||||
case *FundingFlag:
|
||||
var b [1]uint8
|
||||
if _, err := r.Read(b[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
*e = FundingFlag(b[0])
|
||||
case *uint16:
|
||||
var b [2]byte
|
||||
if _, err := io.ReadFull(r, b[:]); err != nil {
|
||||
|
Reference in New Issue
Block a user