multi: rename lnwire.NodeAnnouncement

In preparation for adding a NodeAnnouncement2 struct along with a
NodeAnnouncement interface, this commit renames the existing
NodeAnnouncment struct to NodeAnnouncement1.
This commit is contained in:
Elle Mouton committed 2025-10-01 13:13:32 +02:00
1 parent 8372524edf
commit b8abe130a5
22 files changed
+145 -131

No files matched your search

+5 -5
View File
@@ -398,7 +398,7 @@ type Config struct {
// CurrentNodeAnnouncement should return the latest, fully signed node
// announcement from the backing Lightning Network node with a fresh
// timestamp.
CurrentNodeAnnouncement func() (lnwire.NodeAnnouncement, error)
CurrentNodeAnnouncement func() (lnwire.NodeAnnouncement1, error)
// SendAnnouncement is used by the FundingManager to send announcement
// messages to the Gossiper to possibly broadcast to the greater
@@ -3757,8 +3757,8 @@ func (f *Manager) annAfterSixConfs(completeChan *channeldb.OpenChannel,
shortChanID *lnwire.ShortChannelID) error {
// If this channel is not meant to be announced to the greater network,
// we'll only send our NodeAnnouncement to our counterparty to ensure we
// don't leak any of our information.
// we'll only send our NodeAnnouncement1 to our counterparty to ensure
// we don't leak any of our information.
announceChan := completeChan.ChannelFlags&lnwire.FFAnnounceChannel != 0
if !announceChan {
log.Debugf("Will not announce private channel %v.",
@@ -3779,7 +3779,7 @@ func (f *Manager) annAfterSixConfs(completeChan *channeldb.OpenChannel,
completeChan.FundingOutpoint,
)
pubKey := peer.PubKey()
log.Debugf("Sending our NodeAnnouncement for "+
log.Debugf("Sending our NodeAnnouncement1 for "+
"ChannelID(%v) to %x", chanID, pubKey)
// TODO(halseth): make reliable. If the peer is not online this
@@ -4724,7 +4724,7 @@ func (f *Manager) announceChannel(localIDKey, remoteIDKey *btcec.PublicKey,
graph.ErrIgnored) {
log.Debugf("Graph rejected "+
"NodeAnnouncement: %v", err)
"NodeAnnouncement1: %v", err)
} else {
log.Errorf("Unable to send node "+
"announcement: %v", err)
+14 -13
View File
@@ -485,10 +485,10 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
}
return errChan
},
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement,
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement1,
error) {
return lnwire.NodeAnnouncement{}, nil
return lnwire.NodeAnnouncement1{}, nil
},
TempChanIDSeed: chanIDSeed,
FindChannel: func(node *btcec.PublicKey,
@@ -660,10 +660,10 @@ func recreateAliceFundingManager(t *testing.T, alice *testNode) {
}
return errChan
},
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement,
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement1,
error) {
return lnwire.NodeAnnouncement{}, nil
return lnwire.NodeAnnouncement1{}, nil
},
NotifyWhenOnline: func(peer [33]byte,
connectedChan chan<- lnpeer.Peer) {
@@ -1328,9 +1328,9 @@ func assertAnnouncementSignatures(t *testing.T, alice, bob *testNode) {
// by having the nodes exchange announcement signatures.
// Two distinct messages will be sent:
// 1) AnnouncementSignatures
// 2) NodeAnnouncement
// 2) NodeAnnouncement1
// These may arrive in no particular order.
// Note that sending the NodeAnnouncement at this point is an
// Note that sending the NodeAnnouncement1 at this point is an
// implementation detail, and not something required by the LN spec.
for j, node := range []*testNode{alice, bob} {
announcements := make([]lnwire.Message, 2)
@@ -1348,7 +1348,7 @@ func assertAnnouncementSignatures(t *testing.T, alice, bob *testNode) {
switch msg.(type) {
case *lnwire.AnnounceSignatures1:
gotAnnounceSignatures = true
case *lnwire.NodeAnnouncement:
case *lnwire.NodeAnnouncement1:
gotNodeAnnouncement = true
}
}
@@ -1358,7 +1358,8 @@ func assertAnnouncementSignatures(t *testing.T, alice, bob *testNode) {
j)
}
if !gotNodeAnnouncement {
t.Fatalf("did not get NodeAnnouncement from node %d", j)
t.Fatalf("did not get NodeAnnouncement1 from node %d",
j)
}
}
}
@@ -1378,7 +1379,7 @@ func assertNodeAnnSent(t *testing.T, alice, bob *testNode) {
node.msgChan, time.Second*5,
)
require.NoError(t, err)
assertType[*lnwire.NodeAnnouncement](t, *nodeAnn)
assertType[*lnwire.NodeAnnouncement1](t, *nodeAnn)
}
}
@@ -2959,7 +2960,7 @@ func TestFundingManagerPrivateChannel(t *testing.T) {
// We should however receive each side's node announcement.
select {
case msg := <-alice.msgChan:
if _, ok := msg.(*lnwire.NodeAnnouncement); !ok {
if _, ok := msg.(*lnwire.NodeAnnouncement1); !ok {
t.Fatalf("expected to receive node announcement")
}
case <-time.After(time.Second):
@@ -2968,7 +2969,7 @@ func TestFundingManagerPrivateChannel(t *testing.T) {
select {
case msg := <-bob.msgChan:
if _, ok := msg.(*lnwire.NodeAnnouncement); !ok {
if _, ok := msg.(*lnwire.NodeAnnouncement1); !ok {
t.Fatalf("expected to receive node announcement")
}
case <-time.After(time.Second):
@@ -3085,7 +3086,7 @@ func TestFundingManagerPrivateRestart(t *testing.T) {
// We should however receive each side's node announcement.
select {
case msg := <-alice.msgChan:
if _, ok := msg.(*lnwire.NodeAnnouncement); !ok {
if _, ok := msg.(*lnwire.NodeAnnouncement1); !ok {
t.Fatalf("expected to receive node announcement")
}
case <-time.After(time.Second):
@@ -3094,7 +3095,7 @@ func TestFundingManagerPrivateRestart(t *testing.T) {
select {
case msg := <-bob.msgChan:
if _, ok := msg.(*lnwire.NodeAnnouncement); !ok {
if _, ok := msg.(*lnwire.NodeAnnouncement1); !ok {
t.Fatalf("expected to receive node announcement")
}
case <-time.After(time.Second):