models: create a helper to convert wire NodeAnn to models.LNNode type

And use it in the gossiper. This helps ensure that we do this conversion
consistently.
This commit is contained in:
Elle Mouton
2025-02-05 08:20:10 +02:00
parent c5cff4052b
commit b7509897d5
2 changed files with 20 additions and 15 deletions

View File

@@ -1982,21 +1982,7 @@ func (d *AuthenticatedGossiper) addNode(msg *lnwire.NodeAnnouncement,
err)
}
timestamp := time.Unix(int64(msg.Timestamp), 0)
features := lnwire.NewFeatureVector(msg.Features, lnwire.Features)
node := &models.LightningNode{
HaveNodeAnnouncement: true,
LastUpdate: timestamp,
Addresses: msg.Addresses,
PubKeyBytes: msg.NodeID,
Alias: msg.Alias.String(),
AuthSigBytes: msg.Signature.ToSignatureBytes(),
Features: features,
Color: msg.RGBColor,
ExtraOpaqueData: msg.ExtraOpaqueData,
}
return d.cfg.Graph.AddNode(node, op...)
return d.cfg.Graph.AddNode(models.NodeFromWireAnnouncement(msg), op...)
}
// isPremature decides whether a given network message has a block height+delta