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:
22 files changed
+145
-131
No files matched your search
+12
-11
@@ -244,11 +244,11 @@ type Config struct {
|
|||||||
// FetchSelfAnnouncement retrieves our current node announcement, for
|
// FetchSelfAnnouncement retrieves our current node announcement, for
|
||||||
// use when determining whether we should update our peers about our
|
// use when determining whether we should update our peers about our
|
||||||
// presence in the network.
|
// presence in the network.
|
||||||
FetchSelfAnnouncement func() lnwire.NodeAnnouncement
|
FetchSelfAnnouncement func() lnwire.NodeAnnouncement1
|
||||||
|
|
||||||
// UpdateSelfAnnouncement produces a new announcement for our node with
|
// UpdateSelfAnnouncement produces a new announcement for our node with
|
||||||
// an updated timestamp which can be broadcast to our peers.
|
// an updated timestamp which can be broadcast to our peers.
|
||||||
UpdateSelfAnnouncement func() (lnwire.NodeAnnouncement, error)
|
UpdateSelfAnnouncement func() (lnwire.NodeAnnouncement1, error)
|
||||||
|
|
||||||
// ProofMatureDelta the number of confirmations which is needed before
|
// ProofMatureDelta the number of confirmations which is needed before
|
||||||
// exchange the channel announcement proofs.
|
// exchange the channel announcement proofs.
|
||||||
@@ -1186,7 +1186,7 @@ func (d *deDupedAnnouncements) addMsg(message networkMsg) {
|
|||||||
|
|
||||||
// Node announcements are identified by the Vertex field. Use the
|
// Node announcements are identified by the Vertex field. Use the
|
||||||
// NodeID to create the corresponding Vertex.
|
// NodeID to create the corresponding Vertex.
|
||||||
case *lnwire.NodeAnnouncement:
|
case *lnwire.NodeAnnouncement1:
|
||||||
sender := route.NewVertex(message.source)
|
sender := route.NewVertex(message.source)
|
||||||
deDupKey := route.Vertex(msg.NodeID)
|
deDupKey := route.Vertex(msg.NodeID)
|
||||||
|
|
||||||
@@ -1195,7 +1195,8 @@ func (d *deDupedAnnouncements) addMsg(message networkMsg) {
|
|||||||
oldTimestamp := uint32(0)
|
oldTimestamp := uint32(0)
|
||||||
mws, ok := d.nodeAnnouncements[deDupKey]
|
mws, ok := d.nodeAnnouncements[deDupKey]
|
||||||
if ok {
|
if ok {
|
||||||
oldTimestamp = mws.msg.(*lnwire.NodeAnnouncement).Timestamp
|
ann, _ := mws.msg.(*lnwire.NodeAnnouncement1)
|
||||||
|
oldTimestamp = ann.Timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discard the message if it's old.
|
// Discard the message if it's old.
|
||||||
@@ -1806,7 +1807,7 @@ func (d *AuthenticatedGossiper) retransmitStaleAnns(ctx context.Context,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// We'll also check that our NodeAnnouncement is not too old.
|
// We'll also check that our NodeAnnouncement1 is not too old.
|
||||||
currentNodeAnn := d.cfg.FetchSelfAnnouncement()
|
currentNodeAnn := d.cfg.FetchSelfAnnouncement()
|
||||||
timestamp := time.Unix(int64(currentNodeAnn.Timestamp), 0)
|
timestamp := time.Unix(int64(currentNodeAnn.Timestamp), 0)
|
||||||
timeElapsed := now.Sub(timestamp)
|
timeElapsed := now.Sub(timestamp)
|
||||||
@@ -2062,7 +2063,7 @@ func (d *AuthenticatedGossiper) fetchPKScript(chanID lnwire.ShortChannelID) (
|
|||||||
// addNode processes the given node announcement, and adds it to our channel
|
// addNode processes the given node announcement, and adds it to our channel
|
||||||
// graph.
|
// graph.
|
||||||
func (d *AuthenticatedGossiper) addNode(ctx context.Context,
|
func (d *AuthenticatedGossiper) addNode(ctx context.Context,
|
||||||
msg *lnwire.NodeAnnouncement, op ...batch.SchedulerOption) error {
|
msg *lnwire.NodeAnnouncement1, op ...batch.SchedulerOption) error {
|
||||||
|
|
||||||
if err := netann.ValidateNodeAnn(msg); err != nil {
|
if err := netann.ValidateNodeAnn(msg); err != nil {
|
||||||
return fmt.Errorf("unable to validate node announcement: %w",
|
return fmt.Errorf("unable to validate node announcement: %w",
|
||||||
@@ -2153,7 +2154,7 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(ctx context.Context,
|
|||||||
// A new node announcement has arrived which either presents new
|
// A new node announcement has arrived which either presents new
|
||||||
// information about a node in one of the channels we know about, or a
|
// information about a node in one of the channels we know about, or a
|
||||||
// updating previously advertised information.
|
// updating previously advertised information.
|
||||||
case *lnwire.NodeAnnouncement:
|
case *lnwire.NodeAnnouncement1:
|
||||||
return d.handleNodeAnnouncement(ctx, nMsg, msg, schedulerOp)
|
return d.handleNodeAnnouncement(ctx, nMsg, msg, schedulerOp)
|
||||||
|
|
||||||
// A new channel announcement has arrived, this indicates the
|
// A new channel announcement has arrived, this indicates the
|
||||||
@@ -2248,7 +2249,7 @@ func (d *AuthenticatedGossiper) processZombieUpdate(_ context.Context,
|
|||||||
// announcement fields and returns an error if they are invalid to prevent
|
// announcement fields and returns an error if they are invalid to prevent
|
||||||
// forwarding invalid node announcements to our peers.
|
// forwarding invalid node announcements to our peers.
|
||||||
func (d *AuthenticatedGossiper) fetchNodeAnn(ctx context.Context,
|
func (d *AuthenticatedGossiper) fetchNodeAnn(ctx context.Context,
|
||||||
pubKey [33]byte) (*lnwire.NodeAnnouncement, error) {
|
pubKey [33]byte) (*lnwire.NodeAnnouncement1, error) {
|
||||||
|
|
||||||
node, err := d.cfg.Graph.FetchNode(ctx, pubKey)
|
node, err := d.cfg.Graph.FetchNode(ctx, pubKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -2478,12 +2479,12 @@ func (d *AuthenticatedGossiper) latestHeight() uint32 {
|
|||||||
|
|
||||||
// handleNodeAnnouncement processes a new node announcement.
|
// handleNodeAnnouncement processes a new node announcement.
|
||||||
func (d *AuthenticatedGossiper) handleNodeAnnouncement(ctx context.Context,
|
func (d *AuthenticatedGossiper) handleNodeAnnouncement(ctx context.Context,
|
||||||
nMsg *networkMsg, nodeAnn *lnwire.NodeAnnouncement,
|
nMsg *networkMsg, nodeAnn *lnwire.NodeAnnouncement1,
|
||||||
ops []batch.SchedulerOption) ([]networkMsg, bool) {
|
ops []batch.SchedulerOption) ([]networkMsg, bool) {
|
||||||
|
|
||||||
timestamp := time.Unix(int64(nodeAnn.Timestamp), 0)
|
timestamp := time.Unix(int64(nodeAnn.Timestamp), 0)
|
||||||
|
|
||||||
log.Debugf("Processing NodeAnnouncement: peer=%v, timestamp=%v, "+
|
log.Debugf("Processing NodeAnnouncement1: peer=%v, timestamp=%v, "+
|
||||||
"node=%x, source=%x", nMsg.peer, timestamp, nodeAnn.NodeID,
|
"node=%x, source=%x", nMsg.peer, timestamp, nodeAnn.NodeID,
|
||||||
nMsg.source.SerializeCompressed())
|
nMsg.source.SerializeCompressed())
|
||||||
|
|
||||||
@@ -2542,7 +2543,7 @@ func (d *AuthenticatedGossiper) handleNodeAnnouncement(ctx context.Context,
|
|||||||
nMsg.err <- nil
|
nMsg.err <- nil
|
||||||
// TODO(roasbeef): get rid of the above
|
// TODO(roasbeef): get rid of the above
|
||||||
|
|
||||||
log.Debugf("Processed NodeAnnouncement: peer=%v, timestamp=%v, "+
|
log.Debugf("Processed NodeAnnouncement1: peer=%v, timestamp=%v, "+
|
||||||
"node=%x, source=%x", nMsg.peer, timestamp, nodeAnn.NodeID,
|
"node=%x, source=%x", nMsg.peer, timestamp, nodeAnn.NodeID,
|
||||||
nMsg.source.SerializeCompressed())
|
nMsg.source.SerializeCompressed())
|
||||||
|
|
||||||
|
|||||||
+15
-14
@@ -493,8 +493,8 @@ func (m *mockNotifier) Stop() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type annBatch struct {
|
type annBatch struct {
|
||||||
nodeAnn1 *lnwire.NodeAnnouncement
|
nodeAnn1 *lnwire.NodeAnnouncement1
|
||||||
nodeAnn2 *lnwire.NodeAnnouncement
|
nodeAnn2 *lnwire.NodeAnnouncement1
|
||||||
|
|
||||||
chanAnn *lnwire.ChannelAnnouncement1
|
chanAnn *lnwire.ChannelAnnouncement1
|
||||||
|
|
||||||
@@ -577,8 +577,8 @@ func (ctx *testCtx) createAnnouncements(blockHeight uint32, key1,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func createNodeAnnouncement(priv *btcec.PrivateKey,
|
func createNodeAnnouncement(priv *btcec.PrivateKey, timestamp uint32,
|
||||||
timestamp uint32, extraBytes ...[]byte) (*lnwire.NodeAnnouncement, error) {
|
extraBytes ...[]byte) (*lnwire.NodeAnnouncement1, error) {
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
k := hex.EncodeToString(priv.Serialize())
|
k := hex.EncodeToString(priv.Serialize())
|
||||||
@@ -587,7 +587,7 @@ func createNodeAnnouncement(priv *btcec.PrivateKey,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
a := &lnwire.NodeAnnouncement{
|
a := &lnwire.NodeAnnouncement1{
|
||||||
Timestamp: timestamp,
|
Timestamp: timestamp,
|
||||||
Addresses: testAddrs,
|
Addresses: testAddrs,
|
||||||
Alias: alias,
|
Alias: alias,
|
||||||
@@ -966,15 +966,15 @@ func createTestCtx(t *testing.T, startHeight uint32, isChanPeer bool) (
|
|||||||
c := make(chan struct{})
|
c := make(chan struct{})
|
||||||
return c
|
return c
|
||||||
},
|
},
|
||||||
FetchSelfAnnouncement: func() lnwire.NodeAnnouncement {
|
FetchSelfAnnouncement: func() lnwire.NodeAnnouncement1 {
|
||||||
return lnwire.NodeAnnouncement{
|
return lnwire.NodeAnnouncement1{
|
||||||
Timestamp: testTimestamp,
|
Timestamp: testTimestamp,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
UpdateSelfAnnouncement: func() (lnwire.NodeAnnouncement,
|
UpdateSelfAnnouncement: func() (lnwire.NodeAnnouncement1,
|
||||||
error) {
|
error) {
|
||||||
|
|
||||||
return lnwire.NodeAnnouncement{
|
return lnwire.NodeAnnouncement1{
|
||||||
Timestamp: testTimestamp,
|
Timestamp: testTimestamp,
|
||||||
}, nil
|
}, nil
|
||||||
},
|
},
|
||||||
@@ -2285,7 +2285,7 @@ func TestForwardPrivateNodeAnnouncement(t *testing.T) {
|
|||||||
case <-time.After(2 * trickleDelay):
|
case <-time.After(2 * trickleDelay):
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, we'll attempt to forward the NodeAnnouncement for the same node
|
// Now, we'll attempt to forward the NodeAnnouncement1 for the same node
|
||||||
// by opening a public channel on the network. We'll create a
|
// by opening a public channel on the network. We'll create a
|
||||||
// ChannelAnnouncement and hand it off to the gossiper in order to
|
// ChannelAnnouncement and hand it off to the gossiper in order to
|
||||||
// process it.
|
// process it.
|
||||||
@@ -2312,8 +2312,9 @@ func TestForwardPrivateNodeAnnouncement(t *testing.T) {
|
|||||||
t.Fatal("gossiper should have broadcast the channel announcement")
|
t.Fatal("gossiper should have broadcast the channel announcement")
|
||||||
}
|
}
|
||||||
|
|
||||||
// We'll recreate the NodeAnnouncement with an updated timestamp to
|
// We'll recreate the NodeAnnouncement1 with an updated timestamp to
|
||||||
// prevent a stale update. The NodeAnnouncement should now be forwarded.
|
// prevent a stale update. The NodeAnnouncement1 should now be
|
||||||
|
// forwarded.
|
||||||
nodeAnn, err = createNodeAnnouncement(remoteKeyPriv1, timestamp+1)
|
nodeAnn, err = createNodeAnnouncement(remoteKeyPriv1, timestamp+1)
|
||||||
require.NoError(t, err, "unable to create node announcement")
|
require.NoError(t, err, "unable to create node announcement")
|
||||||
|
|
||||||
@@ -2897,7 +2898,7 @@ func TestExtraDataChannelUpdateValidation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TestExtraDataNodeAnnouncementValidation tests that we're able to properly
|
// TestExtraDataNodeAnnouncementValidation tests that we're able to properly
|
||||||
// validate a NodeAnnouncement that includes opaque bytes that we don't
|
// validate a NodeAnnouncement1 that includes opaque bytes that we don't
|
||||||
// currently know of.
|
// currently know of.
|
||||||
func TestExtraDataNodeAnnouncementValidation(t *testing.T) {
|
func TestExtraDataNodeAnnouncementValidation(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
@@ -3044,7 +3045,7 @@ func TestRetransmit(t *testing.T) {
|
|||||||
chanAnn++
|
chanAnn++
|
||||||
case *lnwire.ChannelUpdate1:
|
case *lnwire.ChannelUpdate1:
|
||||||
chanUpd++
|
chanUpd++
|
||||||
case *lnwire.NodeAnnouncement:
|
case *lnwire.NodeAnnouncement1:
|
||||||
nodeAnn++
|
nodeAnn++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1653,7 +1653,7 @@ func (g *GossipSyncer) FilterGossipMsgs(ctx context.Context,
|
|||||||
|
|
||||||
// Similarly, we only send node announcements if the update
|
// Similarly, we only send node announcements if the update
|
||||||
// timestamp ifs between our set gossip filter time range.
|
// timestamp ifs between our set gossip filter time range.
|
||||||
case *lnwire.NodeAnnouncement:
|
case *lnwire.NodeAnnouncement1:
|
||||||
if passesFilter(msg.Timestamp) {
|
if passesFilter(msg.Timestamp) {
|
||||||
msgsToSend = append(msgsToSend, msg)
|
msgsToSend = append(msgsToSend, msg)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,10 +249,14 @@ func TestGossipSyncerFilterGossipMsgsNoHorizon(t *testing.T) {
|
|||||||
// through the gossiper to the target peer.
|
// through the gossiper to the target peer.
|
||||||
msgs := []msgWithSenders{
|
msgs := []msgWithSenders{
|
||||||
{
|
{
|
||||||
msg: &lnwire.NodeAnnouncement{Timestamp: uint32(time.Now().Unix())},
|
msg: &lnwire.NodeAnnouncement1{
|
||||||
|
Timestamp: uint32(time.Now().Unix()),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
msg: &lnwire.NodeAnnouncement{Timestamp: uint32(time.Now().Unix())},
|
msg: &lnwire.NodeAnnouncement1{
|
||||||
|
Timestamp: uint32(time.Now().Unix()),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,15 +312,21 @@ func TestGossipSyncerFilterGossipMsgsAllInMemory(t *testing.T) {
|
|||||||
msgs := []msgWithSenders{
|
msgs := []msgWithSenders{
|
||||||
{
|
{
|
||||||
// Node ann above horizon.
|
// Node ann above horizon.
|
||||||
msg: &lnwire.NodeAnnouncement{Timestamp: unixStamp(25001)},
|
msg: &lnwire.NodeAnnouncement1{
|
||||||
|
Timestamp: unixStamp(25001),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Node ann below horizon.
|
// Node ann below horizon.
|
||||||
msg: &lnwire.NodeAnnouncement{Timestamp: unixStamp(5)},
|
msg: &lnwire.NodeAnnouncement1{
|
||||||
|
Timestamp: unixStamp(5),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Node ann above horizon.
|
// Node ann above horizon.
|
||||||
msg: &lnwire.NodeAnnouncement{Timestamp: unixStamp(999999)},
|
msg: &lnwire.NodeAnnouncement1{
|
||||||
|
Timestamp: unixStamp(999999),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Ann tuple below horizon.
|
// Ann tuple below horizon.
|
||||||
@@ -737,7 +747,7 @@ func TestGossipSyncerReplyShortChanIDs(t *testing.T) {
|
|||||||
ShortChannelID: lnwire.NewShortChanIDFromInt(20),
|
ShortChannelID: lnwire.NewShortChanIDFromInt(20),
|
||||||
Timestamp: unixStamp(999999),
|
Timestamp: unixStamp(999999),
|
||||||
},
|
},
|
||||||
&lnwire.NodeAnnouncement{Timestamp: unixStamp(25001)},
|
&lnwire.NodeAnnouncement1{Timestamp: unixStamp(25001)},
|
||||||
}
|
}
|
||||||
|
|
||||||
// We'll then craft a reply to the upcoming query for all the matching
|
// We'll then craft a reply to the upcoming query for all the matching
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ func (v *ValidationBarrier) InitJobDependencies(job interface{}) (JobID,
|
|||||||
populateDependencies(msg.ShortChannelID.String(), childJobID)
|
populateDependencies(msg.ShortChannelID.String(), childJobID)
|
||||||
|
|
||||||
return childJobID, nil
|
return childJobID, nil
|
||||||
case *lnwire.NodeAnnouncement:
|
case *lnwire.NodeAnnouncement1:
|
||||||
childJobID := JobID(v.idCtr.Add(1))
|
childJobID := JobID(v.idCtr.Add(1))
|
||||||
populateDependencies(
|
populateDependencies(
|
||||||
route.Vertex(msg.NodeID).String(), childJobID,
|
route.Vertex(msg.NodeID).String(), childJobID,
|
||||||
@@ -242,7 +242,7 @@ func (v *ValidationBarrier) WaitForParents(childJobID JobID,
|
|||||||
v.Lock()
|
v.Lock()
|
||||||
|
|
||||||
switch msg := job.(type) {
|
switch msg := job.(type) {
|
||||||
// Any ChannelUpdate or NodeAnnouncement jobs will need to wait on the
|
// Any ChannelUpdate or NodeAnnouncement1 jobs will need to wait on the
|
||||||
// completion of any active ChannelAnnouncement jobs related to them.
|
// completion of any active ChannelAnnouncement jobs related to them.
|
||||||
case *lnwire.ChannelUpdate1:
|
case *lnwire.ChannelUpdate1:
|
||||||
annID = msg.ShortChannelID.String()
|
annID = msg.ShortChannelID.String()
|
||||||
@@ -258,7 +258,7 @@ func (v *ValidationBarrier) WaitForParents(childJobID JobID,
|
|||||||
jobDesc = fmt.Sprintf("job=lnwire.ChannelUpdate, scid=%v",
|
jobDesc = fmt.Sprintf("job=lnwire.ChannelUpdate, scid=%v",
|
||||||
msg.ShortChannelID.ToUint64())
|
msg.ShortChannelID.ToUint64())
|
||||||
|
|
||||||
case *lnwire.NodeAnnouncement:
|
case *lnwire.NodeAnnouncement1:
|
||||||
annID = route.Vertex(msg.NodeID).String()
|
annID = route.Vertex(msg.NodeID).String()
|
||||||
|
|
||||||
parentJobIDs, ok = v.jobDependencies[childJobID]
|
parentJobIDs, ok = v.jobDependencies[childJobID]
|
||||||
@@ -269,7 +269,7 @@ func (v *ValidationBarrier) WaitForParents(childJobID JobID,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
jobDesc = fmt.Sprintf("job=lnwire.NodeAnnouncement, pub=%s",
|
jobDesc = fmt.Sprintf("job=lnwire.NodeAnnouncement1, pub=%s",
|
||||||
route.Vertex(msg.NodeID))
|
route.Vertex(msg.NodeID))
|
||||||
|
|
||||||
// Other types of jobs can be executed immediately, so we'll just
|
// Other types of jobs can be executed immediately, so we'll just
|
||||||
@@ -446,7 +446,7 @@ func (v *ValidationBarrier) SignalDependents(job interface{}, id JobID) error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
case *lnwire.NodeAnnouncement:
|
case *lnwire.NodeAnnouncement1:
|
||||||
// Remove child job info.
|
// Remove child job info.
|
||||||
return removeJob(route.Vertex(msg.NodeID).String(), id, true)
|
return removeJob(route.Vertex(msg.NodeID).String(), id, true)
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ func TestValidationBarrierQuit(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TestValidationBarrierParentJobsClear tests that creating two parent jobs for
|
// TestValidationBarrierParentJobsClear tests that creating two parent jobs for
|
||||||
// ChannelUpdate / NodeAnnouncement will pause child jobs until the set of
|
// ChannelUpdate / NodeAnnouncement1 will pause child jobs until the set of
|
||||||
// parent jobs has cleared.
|
// parent jobs has cleared.
|
||||||
func TestValidationBarrierParentJobsClear(t *testing.T) {
|
func TestValidationBarrierParentJobsClear(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
@@ -230,14 +230,14 @@ func TestValidationBarrierParentJobsClear(t *testing.T) {
|
|||||||
parentID3, err := barrier.InitJobDependencies(ann3)
|
parentID3, err := barrier.InitJobDependencies(ann3)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Create the ChannelUpdate & NodeAnnouncement messages.
|
// Create the ChannelUpdate & NodeAnnouncement1 messages.
|
||||||
upd1 := &lnwire.ChannelUpdate1{
|
upd1 := &lnwire.ChannelUpdate1{
|
||||||
ShortChannelID: sharedScid,
|
ShortChannelID: sharedScid,
|
||||||
}
|
}
|
||||||
childID1, err := barrier.InitJobDependencies(upd1)
|
childID1, err := barrier.InitJobDependencies(upd1)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
node1 := &lnwire.NodeAnnouncement{
|
node1 := &lnwire.NodeAnnouncement1{
|
||||||
NodeID: sharedNodeID,
|
NodeID: sharedNodeID,
|
||||||
}
|
}
|
||||||
childID2, err := barrier.InitJobDependencies(node1)
|
childID2, err := barrier.InitJobDependencies(node1)
|
||||||
|
|||||||
+5
-5
@@ -398,7 +398,7 @@ type Config struct {
|
|||||||
// CurrentNodeAnnouncement should return the latest, fully signed node
|
// CurrentNodeAnnouncement should return the latest, fully signed node
|
||||||
// announcement from the backing Lightning Network node with a fresh
|
// announcement from the backing Lightning Network node with a fresh
|
||||||
// timestamp.
|
// timestamp.
|
||||||
CurrentNodeAnnouncement func() (lnwire.NodeAnnouncement, error)
|
CurrentNodeAnnouncement func() (lnwire.NodeAnnouncement1, error)
|
||||||
|
|
||||||
// SendAnnouncement is used by the FundingManager to send announcement
|
// SendAnnouncement is used by the FundingManager to send announcement
|
||||||
// messages to the Gossiper to possibly broadcast to the greater
|
// 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 {
|
shortChanID *lnwire.ShortChannelID) error {
|
||||||
|
|
||||||
// If this channel is not meant to be announced to the greater network,
|
// 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
|
// we'll only send our NodeAnnouncement1 to our counterparty to ensure
|
||||||
// don't leak any of our information.
|
// we don't leak any of our information.
|
||||||
announceChan := completeChan.ChannelFlags&lnwire.FFAnnounceChannel != 0
|
announceChan := completeChan.ChannelFlags&lnwire.FFAnnounceChannel != 0
|
||||||
if !announceChan {
|
if !announceChan {
|
||||||
log.Debugf("Will not announce private channel %v.",
|
log.Debugf("Will not announce private channel %v.",
|
||||||
@@ -3779,7 +3779,7 @@ func (f *Manager) annAfterSixConfs(completeChan *channeldb.OpenChannel,
|
|||||||
completeChan.FundingOutpoint,
|
completeChan.FundingOutpoint,
|
||||||
)
|
)
|
||||||
pubKey := peer.PubKey()
|
pubKey := peer.PubKey()
|
||||||
log.Debugf("Sending our NodeAnnouncement for "+
|
log.Debugf("Sending our NodeAnnouncement1 for "+
|
||||||
"ChannelID(%v) to %x", chanID, pubKey)
|
"ChannelID(%v) to %x", chanID, pubKey)
|
||||||
|
|
||||||
// TODO(halseth): make reliable. If the peer is not online this
|
// 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) {
|
graph.ErrIgnored) {
|
||||||
|
|
||||||
log.Debugf("Graph rejected "+
|
log.Debugf("Graph rejected "+
|
||||||
"NodeAnnouncement: %v", err)
|
"NodeAnnouncement1: %v", err)
|
||||||
} else {
|
} else {
|
||||||
log.Errorf("Unable to send node "+
|
log.Errorf("Unable to send node "+
|
||||||
"announcement: %v", err)
|
"announcement: %v", err)
|
||||||
|
|||||||
+14
-13
@@ -485,10 +485,10 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
|
|||||||
}
|
}
|
||||||
return errChan
|
return errChan
|
||||||
},
|
},
|
||||||
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement,
|
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement1,
|
||||||
error) {
|
error) {
|
||||||
|
|
||||||
return lnwire.NodeAnnouncement{}, nil
|
return lnwire.NodeAnnouncement1{}, nil
|
||||||
},
|
},
|
||||||
TempChanIDSeed: chanIDSeed,
|
TempChanIDSeed: chanIDSeed,
|
||||||
FindChannel: func(node *btcec.PublicKey,
|
FindChannel: func(node *btcec.PublicKey,
|
||||||
@@ -660,10 +660,10 @@ func recreateAliceFundingManager(t *testing.T, alice *testNode) {
|
|||||||
}
|
}
|
||||||
return errChan
|
return errChan
|
||||||
},
|
},
|
||||||
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement,
|
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement1,
|
||||||
error) {
|
error) {
|
||||||
|
|
||||||
return lnwire.NodeAnnouncement{}, nil
|
return lnwire.NodeAnnouncement1{}, nil
|
||||||
},
|
},
|
||||||
NotifyWhenOnline: func(peer [33]byte,
|
NotifyWhenOnline: func(peer [33]byte,
|
||||||
connectedChan chan<- lnpeer.Peer) {
|
connectedChan chan<- lnpeer.Peer) {
|
||||||
@@ -1328,9 +1328,9 @@ func assertAnnouncementSignatures(t *testing.T, alice, bob *testNode) {
|
|||||||
// by having the nodes exchange announcement signatures.
|
// by having the nodes exchange announcement signatures.
|
||||||
// Two distinct messages will be sent:
|
// Two distinct messages will be sent:
|
||||||
// 1) AnnouncementSignatures
|
// 1) AnnouncementSignatures
|
||||||
// 2) NodeAnnouncement
|
// 2) NodeAnnouncement1
|
||||||
// These may arrive in no particular order.
|
// 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.
|
// implementation detail, and not something required by the LN spec.
|
||||||
for j, node := range []*testNode{alice, bob} {
|
for j, node := range []*testNode{alice, bob} {
|
||||||
announcements := make([]lnwire.Message, 2)
|
announcements := make([]lnwire.Message, 2)
|
||||||
@@ -1348,7 +1348,7 @@ func assertAnnouncementSignatures(t *testing.T, alice, bob *testNode) {
|
|||||||
switch msg.(type) {
|
switch msg.(type) {
|
||||||
case *lnwire.AnnounceSignatures1:
|
case *lnwire.AnnounceSignatures1:
|
||||||
gotAnnounceSignatures = true
|
gotAnnounceSignatures = true
|
||||||
case *lnwire.NodeAnnouncement:
|
case *lnwire.NodeAnnouncement1:
|
||||||
gotNodeAnnouncement = true
|
gotNodeAnnouncement = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1358,7 +1358,8 @@ func assertAnnouncementSignatures(t *testing.T, alice, bob *testNode) {
|
|||||||
j)
|
j)
|
||||||
}
|
}
|
||||||
if !gotNodeAnnouncement {
|
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,
|
node.msgChan, time.Second*5,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
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.
|
// We should however receive each side's node announcement.
|
||||||
select {
|
select {
|
||||||
case msg := <-alice.msgChan:
|
case msg := <-alice.msgChan:
|
||||||
if _, ok := msg.(*lnwire.NodeAnnouncement); !ok {
|
if _, ok := msg.(*lnwire.NodeAnnouncement1); !ok {
|
||||||
t.Fatalf("expected to receive node announcement")
|
t.Fatalf("expected to receive node announcement")
|
||||||
}
|
}
|
||||||
case <-time.After(time.Second):
|
case <-time.After(time.Second):
|
||||||
@@ -2968,7 +2969,7 @@ func TestFundingManagerPrivateChannel(t *testing.T) {
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
case msg := <-bob.msgChan:
|
case msg := <-bob.msgChan:
|
||||||
if _, ok := msg.(*lnwire.NodeAnnouncement); !ok {
|
if _, ok := msg.(*lnwire.NodeAnnouncement1); !ok {
|
||||||
t.Fatalf("expected to receive node announcement")
|
t.Fatalf("expected to receive node announcement")
|
||||||
}
|
}
|
||||||
case <-time.After(time.Second):
|
case <-time.After(time.Second):
|
||||||
@@ -3085,7 +3086,7 @@ func TestFundingManagerPrivateRestart(t *testing.T) {
|
|||||||
// We should however receive each side's node announcement.
|
// We should however receive each side's node announcement.
|
||||||
select {
|
select {
|
||||||
case msg := <-alice.msgChan:
|
case msg := <-alice.msgChan:
|
||||||
if _, ok := msg.(*lnwire.NodeAnnouncement); !ok {
|
if _, ok := msg.(*lnwire.NodeAnnouncement1); !ok {
|
||||||
t.Fatalf("expected to receive node announcement")
|
t.Fatalf("expected to receive node announcement")
|
||||||
}
|
}
|
||||||
case <-time.After(time.Second):
|
case <-time.After(time.Second):
|
||||||
@@ -3094,7 +3095,7 @@ func TestFundingManagerPrivateRestart(t *testing.T) {
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
case msg := <-bob.msgChan:
|
case msg := <-bob.msgChan:
|
||||||
if _, ok := msg.(*lnwire.NodeAnnouncement); !ok {
|
if _, ok := msg.(*lnwire.NodeAnnouncement1); !ok {
|
||||||
t.Fatalf("expected to receive node announcement")
|
t.Fatalf("expected to receive node announcement")
|
||||||
}
|
}
|
||||||
case <-time.After(time.Second):
|
case <-time.After(time.Second):
|
||||||
|
|||||||
@@ -4754,10 +4754,10 @@ func TestLightningNodePersistence(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Use the raw serialized node announcement message create an
|
// Use the raw serialized node announcement message create an
|
||||||
// lnwire.NodeAnnouncement instance.
|
// lnwire.NodeAnnouncement1 instance.
|
||||||
msg, err := lnwire.ReadMessage(bytes.NewBuffer(nodeAnnBytes), 0)
|
msg, err := lnwire.ReadMessage(bytes.NewBuffer(nodeAnnBytes), 0)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
na, ok := msg.(*lnwire.NodeAnnouncement)
|
na, ok := msg.(*lnwire.NodeAnnouncement1)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
|
|
||||||
// Convert the wire message to our internal node representation.
|
// Convert the wire message to our internal node representation.
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ func (l *Node) AddPubKey(key *btcec.PublicKey) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NodeAnnouncement retrieves the latest node announcement of the node.
|
// NodeAnnouncement retrieves the latest node announcement of the node.
|
||||||
func (l *Node) NodeAnnouncement(signed bool) (*lnwire.NodeAnnouncement,
|
func (l *Node) NodeAnnouncement(signed bool) (*lnwire.NodeAnnouncement1,
|
||||||
error) {
|
error) {
|
||||||
|
|
||||||
if !l.HaveNodeAnnouncement {
|
if !l.HaveNodeAnnouncement {
|
||||||
@@ -108,7 +108,7 @@ func (l *Node) NodeAnnouncement(signed bool) (*lnwire.NodeAnnouncement,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeAnn := &lnwire.NodeAnnouncement{
|
nodeAnn := &lnwire.NodeAnnouncement1{
|
||||||
Features: l.Features.RawFeatureVector,
|
Features: l.Features.RawFeatureVector,
|
||||||
NodeID: l.PubKeyBytes,
|
NodeID: l.PubKeyBytes,
|
||||||
RGBColor: l.Color,
|
RGBColor: l.Color,
|
||||||
@@ -133,8 +133,8 @@ func (l *Node) NodeAnnouncement(signed bool) (*lnwire.NodeAnnouncement,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NodeFromWireAnnouncement creates a Node instance from an
|
// NodeFromWireAnnouncement creates a Node instance from an
|
||||||
// lnwire.NodeAnnouncement message.
|
// lnwire.NodeAnnouncement1 message.
|
||||||
func NodeFromWireAnnouncement(msg *lnwire.NodeAnnouncement) *Node {
|
func NodeFromWireAnnouncement(msg *lnwire.NodeAnnouncement1) *Node {
|
||||||
timestamp := time.Unix(int64(msg.Timestamp), 0)
|
timestamp := time.Unix(int64(msg.Timestamp), 0)
|
||||||
features := lnwire.NewFeatureVector(msg.Features, lnwire.Features)
|
features := lnwire.NewFeatureVector(msg.Features, lnwire.Features)
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
type Config struct {
|
type Config struct {
|
||||||
// GetNodeAnnouncement is used to send our retrieve the current
|
// GetNodeAnnouncement is used to send our retrieve the current
|
||||||
// node announcement information.
|
// node announcement information.
|
||||||
GetNodeAnnouncement func() lnwire.NodeAnnouncement
|
GetNodeAnnouncement func() lnwire.NodeAnnouncement1
|
||||||
|
|
||||||
// ParseAddr parses an address from its string format to a net.Addr.
|
// ParseAddr parses an address from its string format to a net.Addr.
|
||||||
ParseAddr func(addr string) (net.Addr, error)
|
ParseAddr func(addr string) (net.Addr, error)
|
||||||
|
|||||||
+4
-4
@@ -220,10 +220,10 @@ func FuzzNodeAnnouncement(f *testing.F) {
|
|||||||
// can be represented by different underlying bytes. Instead, we
|
// can be represented by different underlying bytes. Instead, we
|
||||||
// compare the normalized string representation of each address.
|
// compare the normalized string representation of each address.
|
||||||
assertEq := func(t *testing.T, x, y any) {
|
assertEq := func(t *testing.T, x, y any) {
|
||||||
require.IsType(t, &NodeAnnouncement{}, x)
|
require.IsType(t, &NodeAnnouncement1{}, x)
|
||||||
first, _ := x.(*NodeAnnouncement)
|
first, _ := x.(*NodeAnnouncement1)
|
||||||
require.IsType(t, &NodeAnnouncement{}, y)
|
require.IsType(t, &NodeAnnouncement1{}, y)
|
||||||
second, _ := y.(*NodeAnnouncement)
|
second, _ := y.(*NodeAnnouncement1)
|
||||||
|
|
||||||
require.Equal(
|
require.Equal(
|
||||||
t, len(first.Addresses), len(second.Addresses),
|
t, len(first.Addresses), len(second.Addresses),
|
||||||
|
|||||||
+2
-2
@@ -166,7 +166,7 @@ func (t MessageType) String() string {
|
|||||||
case MsgChannelUpdate:
|
case MsgChannelUpdate:
|
||||||
return "ChannelUpdate"
|
return "ChannelUpdate"
|
||||||
case MsgNodeAnnouncement:
|
case MsgNodeAnnouncement:
|
||||||
return "NodeAnnouncement"
|
return "NodeAnnouncement1"
|
||||||
case MsgPing:
|
case MsgPing:
|
||||||
return "Ping"
|
return "Ping"
|
||||||
case MsgAnnounceSignatures:
|
case MsgAnnounceSignatures:
|
||||||
@@ -330,7 +330,7 @@ func makeEmptyMessage(msgType MessageType) (Message, error) {
|
|||||||
case MsgChannelUpdate:
|
case MsgChannelUpdate:
|
||||||
msg = &ChannelUpdate1{}
|
msg = &ChannelUpdate1{}
|
||||||
case MsgNodeAnnouncement:
|
case MsgNodeAnnouncement:
|
||||||
msg = &NodeAnnouncement{}
|
msg = &NodeAnnouncement1{}
|
||||||
case MsgPing:
|
case MsgPing:
|
||||||
msg = &Ping{}
|
msg = &Ping{}
|
||||||
case MsgAnnounceSignatures:
|
case MsgAnnounceSignatures:
|
||||||
|
|||||||
@@ -670,11 +670,11 @@ func newMsgChannelAnnouncement(t testing.TB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newMsgNodeAnnouncement(t testing.TB,
|
func newMsgNodeAnnouncement(t testing.TB,
|
||||||
r *rand.Rand) *lnwire.NodeAnnouncement {
|
r *rand.Rand) *lnwire.NodeAnnouncement1 {
|
||||||
|
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
msg := &lnwire.NodeAnnouncement{
|
msg := &lnwire.NodeAnnouncement1{
|
||||||
Features: rawFeatureVector(),
|
Features: rawFeatureVector(),
|
||||||
Timestamp: uint32(r.Int31()),
|
Timestamp: uint32(r.Int31()),
|
||||||
Alias: randAlias(r),
|
Alias: randAlias(r),
|
||||||
|
|||||||
+14
-15
@@ -62,11 +62,11 @@ func (n NodeAlias) String() string {
|
|||||||
return string(bytes.Trim(n[:], "\x00"))
|
return string(bytes.Trim(n[:], "\x00"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeAnnouncement message is used to announce the presence of a Lightning
|
// NodeAnnouncement1 message is used to announce the presence of a Lightning
|
||||||
// node and also to signal that the node is accepting incoming connections.
|
// node and also to signal that the node is accepting incoming connections.
|
||||||
// Each NodeAnnouncement authenticating the advertised information within the
|
// Each NodeAnnouncement1 authenticating the advertised information within the
|
||||||
// announcement via a signature using the advertised node pubkey.
|
// announcement via a signature using the advertised node pubkey.
|
||||||
type NodeAnnouncement struct {
|
type NodeAnnouncement1 struct {
|
||||||
// Signature is used to prove the ownership of node id.
|
// Signature is used to prove the ownership of node id.
|
||||||
Signature Sig
|
Signature Sig
|
||||||
|
|
||||||
@@ -100,19 +100,19 @@ type NodeAnnouncement struct {
|
|||||||
ExtraOpaqueData ExtraOpaqueData
|
ExtraOpaqueData ExtraOpaqueData
|
||||||
}
|
}
|
||||||
|
|
||||||
// A compile time check to ensure NodeAnnouncement implements the
|
// A compile time check to ensure NodeAnnouncement1 implements the
|
||||||
// lnwire.Message interface.
|
// lnwire.Message interface.
|
||||||
var _ Message = (*NodeAnnouncement)(nil)
|
var _ Message = (*NodeAnnouncement1)(nil)
|
||||||
|
|
||||||
// A compile time check to ensure NodeAnnouncement implements the
|
// A compile time check to ensure NodeAnnouncement1 implements the
|
||||||
// lnwire.SizeableMessage interface.
|
// lnwire.SizeableMessage interface.
|
||||||
var _ SizeableMessage = (*NodeAnnouncement)(nil)
|
var _ SizeableMessage = (*NodeAnnouncement1)(nil)
|
||||||
|
|
||||||
// Decode deserializes a serialized NodeAnnouncement stored in the passed
|
// Decode deserializes a serialized NodeAnnouncement1 stored in the passed
|
||||||
// io.Reader observing the specified protocol version.
|
// io.Reader observing the specified protocol version.
|
||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// This is part of the lnwire.Message interface.
|
||||||
func (a *NodeAnnouncement) Decode(r io.Reader, _ uint32) error {
|
func (a *NodeAnnouncement1) Decode(r io.Reader, _ uint32) error {
|
||||||
err := ReadElements(r,
|
err := ReadElements(r,
|
||||||
&a.Signature,
|
&a.Signature,
|
||||||
&a.Features,
|
&a.Features,
|
||||||
@@ -130,11 +130,11 @@ func (a *NodeAnnouncement) Decode(r io.Reader, _ uint32) error {
|
|||||||
return a.ExtraOpaqueData.ValidateTLV()
|
return a.ExtraOpaqueData.ValidateTLV()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode serializes the target NodeAnnouncement into the passed io.Writer
|
// Encode serializes the target NodeAnnouncement1 into the passed io.Writer
|
||||||
// observing the protocol version specified.
|
// observing the protocol version specified.
|
||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// This is part of the lnwire.Message interface.
|
||||||
func (a *NodeAnnouncement) Encode(w *bytes.Buffer, pver uint32) error {
|
func (a *NodeAnnouncement1) Encode(w *bytes.Buffer, pver uint32) error {
|
||||||
if err := WriteSig(w, a.Signature); err != nil {
|
if err := WriteSig(w, a.Signature); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -170,13 +170,12 @@ func (a *NodeAnnouncement) Encode(w *bytes.Buffer, pver uint32) error {
|
|||||||
// wire.
|
// wire.
|
||||||
//
|
//
|
||||||
// This is part of the lnwire.Message interface.
|
// This is part of the lnwire.Message interface.
|
||||||
func (a *NodeAnnouncement) MsgType() MessageType {
|
func (a *NodeAnnouncement1) MsgType() MessageType {
|
||||||
return MsgNodeAnnouncement
|
return MsgNodeAnnouncement
|
||||||
}
|
}
|
||||||
|
|
||||||
// DataToSign returns the part of the message that should be signed.
|
// DataToSign returns the part of the message that should be signed.
|
||||||
func (a *NodeAnnouncement) DataToSign() ([]byte, error) {
|
func (a *NodeAnnouncement1) DataToSign() ([]byte, error) {
|
||||||
|
|
||||||
// We should not include the signatures itself.
|
// We should not include the signatures itself.
|
||||||
buffer := make([]byte, 0, MaxMsgBody)
|
buffer := make([]byte, 0, MaxMsgBody)
|
||||||
buf := bytes.NewBuffer(buffer)
|
buf := bytes.NewBuffer(buffer)
|
||||||
@@ -215,6 +214,6 @@ func (a *NodeAnnouncement) DataToSign() ([]byte, error) {
|
|||||||
// SerializedSize returns the serialized size of the message in bytes.
|
// SerializedSize returns the serialized size of the message in bytes.
|
||||||
//
|
//
|
||||||
// This is part of the lnwire.SizeableMessage interface.
|
// This is part of the lnwire.SizeableMessage interface.
|
||||||
func (a *NodeAnnouncement) SerializedSize() (uint32, error) {
|
func (a *NodeAnnouncement1) SerializedSize() (uint32, error) {
|
||||||
return MessageSerializedSize(a)
|
return MessageSerializedSize(a)
|
||||||
}
|
}
|
||||||
@@ -1215,15 +1215,15 @@ func (ks *KickoffSig) RandTestMessage(t *rapid.T) Message {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// A compile time check to ensure NodeAnnouncement implements the
|
// A compile time check to ensure NodeAnnouncement1 implements the
|
||||||
// lnwire.TestMessage interface.
|
// lnwire.TestMessage interface.
|
||||||
var _ TestMessage = (*NodeAnnouncement)(nil)
|
var _ TestMessage = (*NodeAnnouncement1)(nil)
|
||||||
|
|
||||||
// RandTestMessage populates the message with random data suitable for testing.
|
// RandTestMessage populates the message with random data suitable for testing.
|
||||||
// It uses the rapid testing framework to generate random values.
|
// It uses the rapid testing framework to generate random values.
|
||||||
//
|
//
|
||||||
// This is part of the TestMessage interface.
|
// This is part of the TestMessage interface.
|
||||||
func (a *NodeAnnouncement) RandTestMessage(t *rapid.T) Message {
|
func (a *NodeAnnouncement1) RandTestMessage(t *rapid.T) Message {
|
||||||
// Generate random compressed public key for node ID
|
// Generate random compressed public key for node ID
|
||||||
pubKey := RandPubKey(t)
|
pubKey := RandPubKey(t)
|
||||||
var nodeID [33]byte
|
var nodeID [33]byte
|
||||||
@@ -1236,7 +1236,7 @@ func (a *NodeAnnouncement) RandTestMessage(t *rapid.T) Message {
|
|||||||
B: uint8(rapid.IntRange(0, 255).Draw(t, "rgbB")),
|
B: uint8(rapid.IntRange(0, 255).Draw(t, "rgbB")),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &NodeAnnouncement{
|
return &NodeAnnouncement1{
|
||||||
Signature: RandSignature(t),
|
Signature: RandSignature(t),
|
||||||
Features: RandFeatureVector(t),
|
Features: RandFeatureVector(t),
|
||||||
Timestamp: uint32(rapid.IntRange(0, 0x7FFFFFFF).Draw(
|
Timestamp: uint32(rapid.IntRange(0, 0x7FFFFFFF).Draw(
|
||||||
|
|||||||
+5
-5
@@ -22,8 +22,8 @@ type HostAnnouncerConfig struct {
|
|||||||
LookupHost func(string) (net.Addr, error)
|
LookupHost func(string) (net.Addr, error)
|
||||||
|
|
||||||
// AdvertisedIPs is the set of IPs that we've already announced with
|
// AdvertisedIPs is the set of IPs that we've already announced with
|
||||||
// our current NodeAnnouncement. This set will be constructed to avoid
|
// our current NodeAnnouncement1. This set will be constructed to avoid
|
||||||
// unnecessary node NodeAnnouncement updates.
|
// unnecessary node NodeAnnouncement1 updates.
|
||||||
AdvertisedIPs map[string]struct{}
|
AdvertisedIPs map[string]struct{}
|
||||||
|
|
||||||
// AnnounceNewIPs announces a new set of IP addresses for the backing
|
// AnnounceNewIPs announces a new set of IP addresses for the backing
|
||||||
@@ -36,7 +36,7 @@ type HostAnnouncerConfig struct {
|
|||||||
// HostAnnouncer is a sub-system that allows a user to specify a set of hosts
|
// HostAnnouncer is a sub-system that allows a user to specify a set of hosts
|
||||||
// for lnd that will be continually resolved to notice any IP address changes.
|
// for lnd that will be continually resolved to notice any IP address changes.
|
||||||
// If the target IP address for a host changes, then we'll generate a new
|
// If the target IP address for a host changes, then we'll generate a new
|
||||||
// NodeAnnouncement that includes these new IPs.
|
// NodeAnnouncement1 that includes these new IPs.
|
||||||
type HostAnnouncer struct {
|
type HostAnnouncer struct {
|
||||||
cfg HostAnnouncerConfig
|
cfg HostAnnouncerConfig
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ func (h *HostAnnouncer) hostWatcher() {
|
|||||||
// announcement on disk. It returns the updated node announcement given a set
|
// announcement on disk. It returns the updated node announcement given a set
|
||||||
// of updates to be applied to the current node announcement.
|
// of updates to be applied to the current node announcement.
|
||||||
type NodeAnnUpdater func(modifier ...NodeAnnModifier,
|
type NodeAnnUpdater func(modifier ...NodeAnnModifier,
|
||||||
) (lnwire.NodeAnnouncement, error)
|
) (lnwire.NodeAnnouncement1, error)
|
||||||
|
|
||||||
// IPAnnouncer is a factory function that generates a new function that uses
|
// IPAnnouncer is a factory function that generates a new function that uses
|
||||||
// the passed annUpdater function to to announce new IP changes for a given
|
// the passed annUpdater function to to announce new IP changes for a given
|
||||||
@@ -181,7 +181,7 @@ func IPAnnouncer(annUpdater NodeAnnUpdater) func([]net.Addr,
|
|||||||
|
|
||||||
return func(newAddrs []net.Addr, oldAddrs map[string]struct{}) error {
|
return func(newAddrs []net.Addr, oldAddrs map[string]struct{}) error {
|
||||||
_, err := annUpdater(func(
|
_, err := annUpdater(func(
|
||||||
currentNodeAnn *lnwire.NodeAnnouncement) {
|
currentNodeAnn *lnwire.NodeAnnouncement1) {
|
||||||
// To ensure we don't duplicate any addresses, we'll
|
// To ensure we don't duplicate any addresses, we'll
|
||||||
// filter out the same of addresses we should no longer
|
// filter out the same of addresses we should no longer
|
||||||
// advertise.
|
// advertise.
|
||||||
|
|||||||
+19
-17
@@ -16,37 +16,39 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// NodeAnnModifier is a closure that makes in-place modifications to an
|
// NodeAnnModifier is a closure that makes in-place modifications to an
|
||||||
// lnwire.NodeAnnouncement.
|
// lnwire.NodeAnnouncement1.
|
||||||
type NodeAnnModifier func(*lnwire.NodeAnnouncement)
|
type NodeAnnModifier func(*lnwire.NodeAnnouncement1)
|
||||||
|
|
||||||
// NodeAnnSetAlias is a functional option that sets the alias of the
|
// NodeAnnSetAlias is a functional option that sets the alias of the
|
||||||
// given node announcement.
|
// given node announcement.
|
||||||
func NodeAnnSetAlias(alias lnwire.NodeAlias) func(*lnwire.NodeAnnouncement) {
|
func NodeAnnSetAlias(alias lnwire.NodeAlias) func(*lnwire.NodeAnnouncement1) {
|
||||||
return func(nodeAnn *lnwire.NodeAnnouncement) {
|
return func(nodeAnn *lnwire.NodeAnnouncement1) {
|
||||||
nodeAnn.Alias = alias
|
nodeAnn.Alias = alias
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeAnnSetAddrs is a functional option that allows updating the addresses of
|
// NodeAnnSetAddrs is a functional option that allows updating the addresses of
|
||||||
// the given node announcement.
|
// the given node announcement.
|
||||||
func NodeAnnSetAddrs(addrs []net.Addr) func(*lnwire.NodeAnnouncement) {
|
func NodeAnnSetAddrs(addrs []net.Addr) func(*lnwire.NodeAnnouncement1) {
|
||||||
return func(nodeAnn *lnwire.NodeAnnouncement) {
|
return func(nodeAnn *lnwire.NodeAnnouncement1) {
|
||||||
nodeAnn.Addresses = addrs
|
nodeAnn.Addresses = addrs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeAnnSetColor is a functional option that sets the color of the
|
// NodeAnnSetColor is a functional option that sets the color of the
|
||||||
// given node announcement.
|
// given node announcement.
|
||||||
func NodeAnnSetColor(newColor color.RGBA) func(*lnwire.NodeAnnouncement) {
|
func NodeAnnSetColor(newColor color.RGBA) func(*lnwire.NodeAnnouncement1) {
|
||||||
return func(nodeAnn *lnwire.NodeAnnouncement) {
|
return func(nodeAnn *lnwire.NodeAnnouncement1) {
|
||||||
nodeAnn.RGBColor = newColor
|
nodeAnn.RGBColor = newColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeAnnSetFeatures is a functional option that allows updating the features of
|
// NodeAnnSetFeatures is a functional option that allows updating the features of
|
||||||
// the given node announcement.
|
// the given node announcement.
|
||||||
func NodeAnnSetFeatures(features *lnwire.RawFeatureVector) func(*lnwire.NodeAnnouncement) {
|
func NodeAnnSetFeatures(
|
||||||
return func(nodeAnn *lnwire.NodeAnnouncement) {
|
features *lnwire.RawFeatureVector) func(*lnwire.NodeAnnouncement1) {
|
||||||
|
|
||||||
|
return func(nodeAnn *lnwire.NodeAnnouncement1) {
|
||||||
nodeAnn.Features = features
|
nodeAnn.Features = features
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,7 +56,7 @@ func NodeAnnSetFeatures(features *lnwire.RawFeatureVector) func(*lnwire.NodeAnno
|
|||||||
// NodeAnnSetTimestamp is a functional option that sets the timestamp of the
|
// NodeAnnSetTimestamp is a functional option that sets the timestamp of the
|
||||||
// announcement to the current time, or increments it if the timestamp is
|
// announcement to the current time, or increments it if the timestamp is
|
||||||
// already in the future.
|
// already in the future.
|
||||||
func NodeAnnSetTimestamp(nodeAnn *lnwire.NodeAnnouncement) {
|
func NodeAnnSetTimestamp(nodeAnn *lnwire.NodeAnnouncement1) {
|
||||||
newTimestamp := uint32(time.Now().Unix())
|
newTimestamp := uint32(time.Now().Unix())
|
||||||
if newTimestamp <= nodeAnn.Timestamp {
|
if newTimestamp <= nodeAnn.Timestamp {
|
||||||
// Increment the prior value to ensure the timestamp
|
// Increment the prior value to ensure the timestamp
|
||||||
@@ -65,11 +67,11 @@ func NodeAnnSetTimestamp(nodeAnn *lnwire.NodeAnnouncement) {
|
|||||||
nodeAnn.Timestamp = newTimestamp
|
nodeAnn.Timestamp = newTimestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
// SignNodeAnnouncement signs the lnwire.NodeAnnouncement provided, which
|
// SignNodeAnnouncement signs the lnwire.NodeAnnouncement1 provided, which
|
||||||
// should be the most recent, valid update, otherwise the timestamp may not
|
// should be the most recent, valid update, otherwise the timestamp may not
|
||||||
// monotonically increase from the prior.
|
// monotonically increase from the prior.
|
||||||
func SignNodeAnnouncement(signer lnwallet.MessageSigner,
|
func SignNodeAnnouncement(signer lnwallet.MessageSigner,
|
||||||
keyLoc keychain.KeyLocator, nodeAnn *lnwire.NodeAnnouncement) error {
|
keyLoc keychain.KeyLocator, nodeAnn *lnwire.NodeAnnouncement1) error {
|
||||||
|
|
||||||
// Create the DER-encoded ECDSA signature over the message digest.
|
// Create the DER-encoded ECDSA signature over the message digest.
|
||||||
sig, err := SignAnnouncement(signer, keyLoc, nodeAnn)
|
sig, err := SignAnnouncement(signer, keyLoc, nodeAnn)
|
||||||
@@ -83,7 +85,7 @@ func SignNodeAnnouncement(signer lnwallet.MessageSigner,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ValidateNodeAnn validates the fields and signature of a node announcement.
|
// ValidateNodeAnn validates the fields and signature of a node announcement.
|
||||||
func ValidateNodeAnn(a *lnwire.NodeAnnouncement) error {
|
func ValidateNodeAnn(a *lnwire.NodeAnnouncement1) error {
|
||||||
err := ValidateNodeAnnFields(a)
|
err := ValidateNodeAnnFields(a)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("invalid node announcement fields: %w", err)
|
return fmt.Errorf("invalid node announcement fields: %w", err)
|
||||||
@@ -93,7 +95,7 @@ func ValidateNodeAnn(a *lnwire.NodeAnnouncement) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ValidateNodeAnnFields validates the fields of a node announcement.
|
// ValidateNodeAnnFields validates the fields of a node announcement.
|
||||||
func ValidateNodeAnnFields(a *lnwire.NodeAnnouncement) error {
|
func ValidateNodeAnnFields(a *lnwire.NodeAnnouncement1) error {
|
||||||
// Check that it only has at most one DNS address.
|
// Check that it only has at most one DNS address.
|
||||||
hasDNSAddr := false
|
hasDNSAddr := false
|
||||||
for _, addr := range a.Addresses {
|
for _, addr := range a.Addresses {
|
||||||
@@ -120,7 +122,7 @@ func ValidateNodeAnnFields(a *lnwire.NodeAnnouncement) error {
|
|||||||
// ValidateNodeAnnSignature validates the node announcement by ensuring that the
|
// ValidateNodeAnnSignature validates the node announcement by ensuring that the
|
||||||
// attached signature is needed a signature of the node announcement under the
|
// attached signature is needed a signature of the node announcement under the
|
||||||
// specified node public key.
|
// specified node public key.
|
||||||
func ValidateNodeAnnSignature(a *lnwire.NodeAnnouncement) error {
|
func ValidateNodeAnnSignature(a *lnwire.NodeAnnouncement1) error {
|
||||||
// Reconstruct the data of announcement which should be covered by the
|
// Reconstruct the data of announcement which should be covered by the
|
||||||
// signature so we can verify the signature shortly below
|
// signature so we can verify the signature shortly below
|
||||||
data, err := a.DataToSign()
|
data, err := a.DataToSign()
|
||||||
@@ -146,7 +148,7 @@ func ValidateNodeAnnSignature(a *lnwire.NodeAnnouncement) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Errorf("signature on NodeAnnouncement(%x) is "+
|
return fmt.Errorf("signature on NodeAnnouncement1(%x) is "+
|
||||||
"invalid: %x", nodeKey.SerializeCompressed(),
|
"invalid: %x", nodeKey.SerializeCompressed(),
|
||||||
msgBuf.Bytes())
|
msgBuf.Bytes())
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ func SignAnnouncement(signer lnwallet.MessageSigner, keyLoc keychain.KeyLocator,
|
|||||||
data, err = m.DataToSign()
|
data, err = m.DataToSign()
|
||||||
case *lnwire.ChannelUpdate1:
|
case *lnwire.ChannelUpdate1:
|
||||||
data, err = m.DataToSign()
|
data, err = m.DataToSign()
|
||||||
case *lnwire.NodeAnnouncement:
|
case *lnwire.NodeAnnouncement1:
|
||||||
data, err = m.DataToSign()
|
data, err = m.DataToSign()
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("can't sign %T message", m)
|
return nil, fmt.Errorf("can't sign %T message", m)
|
||||||
|
|||||||
+4
-4
@@ -329,7 +329,7 @@ type Config struct {
|
|||||||
// GenNodeAnnouncement is used to send our node announcement to the remote
|
// GenNodeAnnouncement is used to send our node announcement to the remote
|
||||||
// on startup.
|
// on startup.
|
||||||
GenNodeAnnouncement func(...netann.NodeAnnModifier) (
|
GenNodeAnnouncement func(...netann.NodeAnnModifier) (
|
||||||
lnwire.NodeAnnouncement, error)
|
lnwire.NodeAnnouncement1, error)
|
||||||
|
|
||||||
// PrunePersistentPeerConnection is used to remove all internal state
|
// PrunePersistentPeerConnection is used to remove all internal state
|
||||||
// related to this peer in the server.
|
// related to this peer in the server.
|
||||||
@@ -2092,7 +2092,7 @@ out:
|
|||||||
idleTimer.Reset(idleTimeout)
|
idleTimer.Reset(idleTimeout)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
// If the NodeAnnouncement has an invalid alias, then
|
// If the NodeAnnouncement1 has an invalid alias, then
|
||||||
// we'll log that error above and continue so we can
|
// we'll log that error above and continue so we can
|
||||||
// continue to read messages from the peer. We do not
|
// continue to read messages from the peer. We do not
|
||||||
// store this error because it is of little debugging
|
// store this error because it is of little debugging
|
||||||
@@ -2213,7 +2213,7 @@ out:
|
|||||||
|
|
||||||
case *lnwire.ChannelUpdate1,
|
case *lnwire.ChannelUpdate1,
|
||||||
*lnwire.ChannelAnnouncement1,
|
*lnwire.ChannelAnnouncement1,
|
||||||
*lnwire.NodeAnnouncement,
|
*lnwire.NodeAnnouncement1,
|
||||||
*lnwire.AnnounceSignatures1,
|
*lnwire.AnnounceSignatures1,
|
||||||
*lnwire.GossipTimestampRange,
|
*lnwire.GossipTimestampRange,
|
||||||
*lnwire.QueryShortChanIDs,
|
*lnwire.QueryShortChanIDs,
|
||||||
@@ -2494,7 +2494,7 @@ func messageSummary(msg lnwire.Message) string {
|
|||||||
msg.ShortChannelID.ToUint64(), msg.MessageFlags,
|
msg.ShortChannelID.ToUint64(), msg.MessageFlags,
|
||||||
msg.ChannelFlags, time.Unix(int64(msg.Timestamp), 0))
|
msg.ChannelFlags, time.Unix(int64(msg.Timestamp), 0))
|
||||||
|
|
||||||
case *lnwire.NodeAnnouncement:
|
case *lnwire.NodeAnnouncement1:
|
||||||
return fmt.Sprintf("node=%x, update_time=%v",
|
return fmt.Sprintf("node=%x, update_time=%v",
|
||||||
msg.NodeID, time.Unix(int64(msg.Timestamp), 0))
|
msg.NodeID, time.Unix(int64(msg.Timestamp), 0))
|
||||||
|
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ type server struct {
|
|||||||
// currentNodeAnn is the node announcement that has been broadcast to
|
// currentNodeAnn is the node announcement that has been broadcast to
|
||||||
// the network upon startup, if the attributes of the node (us) has
|
// the network upon startup, if the attributes of the node (us) has
|
||||||
// changed since last start.
|
// changed since last start.
|
||||||
currentNodeAnn *lnwire.NodeAnnouncement
|
currentNodeAnn *lnwire.NodeAnnouncement1
|
||||||
|
|
||||||
// chansToRestore is the set of channels that upon starting, the server
|
// chansToRestore is the set of channels that upon starting, the server
|
||||||
// should attempt to restore/recover.
|
// should attempt to restore/recover.
|
||||||
@@ -1069,7 +1069,7 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
|
|||||||
NotifyWhenOnline: s.NotifyWhenOnline,
|
NotifyWhenOnline: s.NotifyWhenOnline,
|
||||||
NotifyWhenOffline: s.NotifyWhenOffline,
|
NotifyWhenOffline: s.NotifyWhenOffline,
|
||||||
FetchSelfAnnouncement: s.getNodeAnnouncement,
|
FetchSelfAnnouncement: s.getNodeAnnouncement,
|
||||||
UpdateSelfAnnouncement: func() (lnwire.NodeAnnouncement,
|
UpdateSelfAnnouncement: func() (lnwire.NodeAnnouncement1,
|
||||||
error) {
|
error) {
|
||||||
|
|
||||||
return s.genNodeAnnouncement(nil)
|
return s.genNodeAnnouncement(nil)
|
||||||
@@ -1466,7 +1466,7 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
|
|||||||
ChannelDB: s.chanStateDB,
|
ChannelDB: s.chanStateDB,
|
||||||
FeeEstimator: cc.FeeEstimator,
|
FeeEstimator: cc.FeeEstimator,
|
||||||
SignMessage: cc.MsgSigner.SignMessage,
|
SignMessage: cc.MsgSigner.SignMessage,
|
||||||
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement,
|
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement1,
|
||||||
error) {
|
error) {
|
||||||
|
|
||||||
return s.genNodeAnnouncement(nil)
|
return s.genNodeAnnouncement(nil)
|
||||||
@@ -1796,7 +1796,7 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
|
|||||||
AdvertisedIPs: advertisedIPs,
|
AdvertisedIPs: advertisedIPs,
|
||||||
AnnounceNewIPs: netann.IPAnnouncer(
|
AnnounceNewIPs: netann.IPAnnouncer(
|
||||||
func(modifier ...netann.NodeAnnModifier) (
|
func(modifier ...netann.NodeAnnModifier) (
|
||||||
lnwire.NodeAnnouncement, error) {
|
lnwire.NodeAnnouncement1, error) {
|
||||||
|
|
||||||
return s.genNodeAnnouncement(
|
return s.genNodeAnnouncement(
|
||||||
nil, modifier...,
|
nil, modifier...,
|
||||||
@@ -3306,7 +3306,7 @@ func (s *server) createNewHiddenService(ctx context.Context) error {
|
|||||||
// Now that the onion service has been created, we'll add the onion
|
// Now that the onion service has been created, we'll add the onion
|
||||||
// address it can be reached at to our list of advertised addresses.
|
// address it can be reached at to our list of advertised addresses.
|
||||||
newNodeAnn, err := s.genNodeAnnouncement(
|
newNodeAnn, err := s.genNodeAnnouncement(
|
||||||
nil, func(currentAnn *lnwire.NodeAnnouncement) {
|
nil, func(currentAnn *lnwire.NodeAnnouncement1) {
|
||||||
currentAnn.Addresses = append(currentAnn.Addresses, addr)
|
currentAnn.Addresses = append(currentAnn.Addresses, addr)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -3357,7 +3357,7 @@ func (s *server) findChannel(node *btcec.PublicKey, chanID lnwire.ChannelID) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getNodeAnnouncement fetches the current, fully signed node announcement.
|
// getNodeAnnouncement fetches the current, fully signed node announcement.
|
||||||
func (s *server) getNodeAnnouncement() lnwire.NodeAnnouncement {
|
func (s *server) getNodeAnnouncement() lnwire.NodeAnnouncement1 {
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
defer s.mu.Unlock()
|
defer s.mu.Unlock()
|
||||||
|
|
||||||
@@ -3368,7 +3368,7 @@ func (s *server) getNodeAnnouncement() lnwire.NodeAnnouncement {
|
|||||||
// announcement. The time stamp of the announcement will be updated in order
|
// announcement. The time stamp of the announcement will be updated in order
|
||||||
// to ensure it propagates through the network.
|
// to ensure it propagates through the network.
|
||||||
func (s *server) genNodeAnnouncement(features *lnwire.RawFeatureVector,
|
func (s *server) genNodeAnnouncement(features *lnwire.RawFeatureVector,
|
||||||
modifiers ...netann.NodeAnnModifier) (lnwire.NodeAnnouncement, error) {
|
modifiers ...netann.NodeAnnModifier) (lnwire.NodeAnnouncement1, error) {
|
||||||
|
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
defer s.mu.Unlock()
|
defer s.mu.Unlock()
|
||||||
@@ -3386,7 +3386,7 @@ func (s *server) genNodeAnnouncement(features *lnwire.RawFeatureVector,
|
|||||||
}
|
}
|
||||||
err := s.featureMgr.UpdateFeatureSets(proposedFeatures)
|
err := s.featureMgr.UpdateFeatureSets(proposedFeatures)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return lnwire.NodeAnnouncement{}, err
|
return lnwire.NodeAnnouncement1{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we could successfully update our feature manager, add
|
// If we could successfully update our feature manager, add
|
||||||
@@ -3411,7 +3411,7 @@ func (s *server) genNodeAnnouncement(features *lnwire.RawFeatureVector,
|
|||||||
s.nodeSigner, s.identityKeyLoc, &newNodeAnn,
|
s.nodeSigner, s.identityKeyLoc, &newNodeAnn,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return lnwire.NodeAnnouncement{}, err
|
return lnwire.NodeAnnouncement1{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If signing succeeds, update the current announcement.
|
// If signing succeeds, update the current announcement.
|
||||||
@@ -3501,7 +3501,7 @@ func (s *server) establishPersistentConnections(ctx context.Context) error {
|
|||||||
|
|
||||||
// After checking our previous connections for addresses to connect to,
|
// After checking our previous connections for addresses to connect to,
|
||||||
// iterate through the nodes in our channel graph to find addresses
|
// iterate through the nodes in our channel graph to find addresses
|
||||||
// that have been added via NodeAnnouncement messages.
|
// that have been added via NodeAnnouncement1 messages.
|
||||||
// TODO(roasbeef): instead iterate over link nodes and query graph for
|
// TODO(roasbeef): instead iterate over link nodes and query graph for
|
||||||
// each of the nodes.
|
// each of the nodes.
|
||||||
graphAddrs := make(map[string]*nodeAddresses)
|
graphAddrs := make(map[string]*nodeAddresses)
|
||||||
@@ -4394,7 +4394,7 @@ func (s *server) peerConnected(conn net.Conn, connReq *connmgr.ConnReq,
|
|||||||
TowerClient: towerClient,
|
TowerClient: towerClient,
|
||||||
DisconnectPeer: s.DisconnectPeer,
|
DisconnectPeer: s.DisconnectPeer,
|
||||||
GenNodeAnnouncement: func(...netann.NodeAnnModifier) (
|
GenNodeAnnouncement: func(...netann.NodeAnnModifier) (
|
||||||
lnwire.NodeAnnouncement, error) {
|
lnwire.NodeAnnouncement1, error) {
|
||||||
|
|
||||||
return s.genNodeAnnouncement(nil)
|
return s.genNodeAnnouncement(nil)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ func (s *subRPCServerConfigs) PopulateDependencies(cfg *Config,
|
|||||||
tcpResolver lncfg.TCPResolver,
|
tcpResolver lncfg.TCPResolver,
|
||||||
genInvoiceFeatures func() *lnwire.FeatureVector,
|
genInvoiceFeatures func() *lnwire.FeatureVector,
|
||||||
genAmpInvoiceFeatures func() *lnwire.FeatureVector,
|
genAmpInvoiceFeatures func() *lnwire.FeatureVector,
|
||||||
getNodeAnnouncement func() lnwire.NodeAnnouncement,
|
getNodeAnnouncement func() lnwire.NodeAnnouncement1,
|
||||||
updateNodeAnnouncement func(ctx context.Context,
|
updateNodeAnnouncement func(ctx context.Context,
|
||||||
features *lnwire.RawFeatureVector,
|
features *lnwire.RawFeatureVector,
|
||||||
modifiers ...netann.NodeAnnModifier) error,
|
modifiers ...netann.NodeAnnModifier) error,
|
||||||
|
|||||||
Reference in new issue
Block a user