mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-11 01:29:19 +01:00
lnwire: fix serialization order of features+addresses in NodeAnnouncement
This commit fixes a deviant in the way we serialize and deserialize the node announcement message from that which is currently in the spec. Before this commit we reversed the order of features and addresses. Instead, on the wire, features should come _before_ the addresses. We also add a new temporary feature bit to ensure nodes that don’t directly connect to each other if they don’t have this new update. However, this will also partition any current tests nets when new nodes join them as the digest signed has changed, therefore invalidating any older messages. Fixes #207.
This commit is contained in:
parent
14f49d4a22
commit
1124b4556f
2 changed files with 7 additions and 3 deletions
|
@ -13,4 +13,8 @@ var localFeatures = lnwire.NewFeatureVector([]lnwire.Feature{
|
|||
Name: "new-ping-and-funding",
|
||||
Flag: lnwire.RequiredFlag,
|
||||
},
|
||||
{
|
||||
Name: "node-ann-feature-addr-swap",
|
||||
Flag: lnwire.RequiredFlag,
|
||||
},
|
||||
})
|
||||
|
|
|
@ -120,8 +120,8 @@ func (a *NodeAnnouncement) Decode(r io.Reader, pver uint32) error {
|
|||
&a.NodeID,
|
||||
&a.RGBColor,
|
||||
&a.Alias,
|
||||
&a.Addresses,
|
||||
&a.Features,
|
||||
&a.Addresses,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -135,8 +135,8 @@ func (a *NodeAnnouncement) Encode(w io.Writer, pver uint32) error {
|
|||
a.NodeID,
|
||||
a.RGBColor,
|
||||
a.Alias,
|
||||
a.Addresses,
|
||||
a.Features,
|
||||
a.Addresses,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -166,8 +166,8 @@ func (a *NodeAnnouncement) DataToSign() ([]byte, error) {
|
|||
a.NodeID,
|
||||
a.RGBColor,
|
||||
a.Alias,
|
||||
a.Addresses,
|
||||
a.Features,
|
||||
a.Addresses,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Reference in a new issue