lnwire: add support for Features in NodeAnnouncement

Add support for Features in NodeAnnouncment according to spec.
This commit is contained in:
bryanvu authored and Olaoluwa Osuntokun committed 2017-03-29 12:03:43 -07:00
1 parent 3087bec4db
commit 085b7333cb
10 files changed
+145 -32

No files matched your search

+7
View File
@@ -97,6 +97,9 @@ type NodeAnnouncement struct {
// Alias is used to customize their node's appearance in maps and graphs
Alias Alias
// Features is the list of protocol features this node supports.
Features *FeatureVector
// Address includes two specification fields: 'ipv6' and 'port' on which
// the node is accepting incoming connections.
Addresses []net.Addr
@@ -127,6 +130,7 @@ func (a *NodeAnnouncement) Decode(r io.Reader, pver uint32) error {
&a.RGBColor,
&a.Alias,
&a.Addresses,
&a.Features,
)
}
@@ -141,6 +145,7 @@ func (a *NodeAnnouncement) Encode(w io.Writer, pver uint32) error {
a.RGBColor,
a.Alias,
a.Addresses,
a.Features,
)
}
@@ -162,6 +167,7 @@ func (a *NodeAnnouncement) MaxPayloadLength(pver uint32) uint32 {
// NodeID - 33 bytes
// RGBColor - 3 bytes
// Alias - 32 bytes
// Features - variable
// NumAddresses - 2 bytes
// AddressDescriptor - 1 byte
// Ipv4 - 4 bytes (optional)
@@ -183,6 +189,7 @@ func (a *NodeAnnouncement) DataToSign() ([]byte, error) {
a.RGBColor,
a.Alias,
a.Addresses,
a.Features,
)
if err != nil {
return nil, err