From c6263c2fe678055aad44236fd5f5ca7e7d0bef66 Mon Sep 17 00:00:00 2001
From: Carla Kirk-Cohen <kirkcohenc@gmail.com>
Date: Mon, 3 Apr 2023 09:43:46 +0200
Subject: [PATCH] multi/refactor: move node ann modification outside of sign
 method

In preparation for moving feature bit modification inside of the
feature manager, separate node modification from signing.
---
 netann/node_announcement.go | 15 ++++-----------
 server.go                   |  6 +++++-
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/netann/node_announcement.go b/netann/node_announcement.go
index 42296bf22..5b6f7a430 100644
--- a/netann/node_announcement.go
+++ b/netann/node_announcement.go
@@ -60,18 +60,11 @@ func NodeAnnSetTimestamp(nodeAnn *lnwire.NodeAnnouncement) {
 	nodeAnn.Timestamp = newTimestamp
 }
 
-// SignNodeAnnouncement applies the given modifies to the passed
-// lnwire.NodeAnnouncement, then signs the resulting announcement. The provided
-// update should be the most recent, valid update, otherwise the timestamp may
-// not monotonically increase from the prior.
+// SignNodeAnnouncement signs the lnwire.NodeAnnouncement provided, which
+// should be the most recent, valid update, otherwise the timestamp may not
+// monotonically increase from the prior.
 func SignNodeAnnouncement(signer lnwallet.MessageSigner,
-	keyLoc keychain.KeyLocator, nodeAnn *lnwire.NodeAnnouncement,
-	mods ...NodeAnnModifier) error {
-
-	// Apply the requested changes to the node announcement.
-	for _, modifier := range mods {
-		modifier(nodeAnn)
-	}
+	keyLoc keychain.KeyLocator, nodeAnn *lnwire.NodeAnnouncement) error {
 
 	// Create the DER-encoded ECDSA signature over the message digest.
 	sig, err := SignAnnouncement(signer, keyLoc, nodeAnn)
diff --git a/server.go b/server.go
index caefe4a50..97aad7a02 100644
--- a/server.go
+++ b/server.go
@@ -2961,11 +2961,15 @@ func (s *server) genNodeAnnouncement(refresh bool,
 	// propagates.
 	modifiers = append(modifiers, netann.NodeAnnSetTimestamp)
 
+	// Apply the requested changes to the node announcement.
+	for _, modifier := range modifiers {
+		modifier(s.currentNodeAnn)
+	}
+
 	// Otherwise, we'll sign a new update after applying all of the passed
 	// modifiers.
 	err := netann.SignNodeAnnouncement(
 		s.nodeSigner, s.identityKeyLoc, s.currentNodeAnn,
-		modifiers...,
 	)
 	if err != nil {
 		return lnwire.NodeAnnouncement{}, err