multi: remove HaveNodeAnnouncement field from Node

Remove the 2 sources of truth here. If we have a signature for the
node, then we have the announcement.
This commit is contained in:
Elle Mouton authored and yyforyongyu committed 2025-11-12 22:54:04 +08:00
1 parent a394938dfd
commit 8f205e2d1c
15 files changed
+154 -182

No files matched your search

+8 -11
View File
@@ -3300,10 +3300,9 @@ func (s *server) createNewHiddenService(ctx context.Context) error {
// Finally, we'll update the on-disk version of our announcement so it
// will eventually propagate to nodes in the network.
selfNode := &models.Node{
HaveNodeAnnouncement: true,
LastUpdate: time.Unix(int64(newNodeAnn.Timestamp), 0),
Addresses: newNodeAnn.Addresses,
Alias: newNodeAnn.Alias.String(),
LastUpdate: time.Unix(int64(newNodeAnn.Timestamp), 0),
Addresses: newNodeAnn.Addresses,
Alias: newNodeAnn.Alias.String(),
Features: lnwire.NewFeatureVector(
newNodeAnn.Features, lnwire.Features,
),
@@ -3424,7 +3423,6 @@ func (s *server) updateAndBroadcastSelfNode(ctx context.Context,
return fmt.Errorf("unable to get current source node: %w", err)
}
selfNode.HaveNodeAnnouncement = true
selfNode.LastUpdate = time.Unix(int64(newNodeAnn.Timestamp), 0)
selfNode.Addresses = newNodeAnn.Addresses
selfNode.Alias = newNodeAnn.Alias.String()
@@ -5646,12 +5644,11 @@ func (s *server) setSelfNode(ctx context.Context, nodePub route.Vertex,
// TODO(abdulkbk): potentially find a way to use the source node's
// features in the self node.
selfNode := &models.Node{
HaveNodeAnnouncement: true,
LastUpdate: nodeLastUpdate,
Addresses: addrs,
Alias: nodeAlias.String(),
Color: color,
Features: s.featureMgr.Get(feature.SetNodeAnn),
LastUpdate: nodeLastUpdate,
Addresses: addrs,
Alias: nodeAlias.String(),
Color: color,
Features: s.featureMgr.Get(feature.SetNodeAnn),
}
copy(selfNode.PubKeyBytes[:], nodePub[:])