routing: Require adding edge to node before adding node.

This commit introduces the requirement specified in BOLT#7,
where we ignore any node announcements for a specific node
if we yet haven't seen any channel announcements where this
node takes part. This is to prevent someone DoS-ing the
network with cheap node announcements. In the router this
is enforced by requiring a call to AddNode(node_id) to
be preceded by an AddEdge(edge_id) call, where node_id is
one of the nodes in edge_id.
This commit is contained in:
Johan T. Halseth authored and Olaoluwa Osuntokun committed 2017-08-02 15:58:58 -07:00
1 parent bd0465ee1d
commit 39a59bbe6f
5 files changed
+423 -78

No files matched your search

+7 -6
View File
@@ -165,12 +165,13 @@ func parseTestGraph(path string) (*channeldb.ChannelGraph, func(), aliasMap, err
}
dbNode := &channeldb.LightningNode{
AuthSig: testSig,
LastUpdate: time.Now(),
Addresses: testAddrs,
PubKey: pub,
Alias: node.Alias,
Features: testFeatures,
HaveNodeAnnouncement: true,
AuthSig: testSig,
LastUpdate: time.Now(),
Addresses: testAddrs,
PubKey: pub,
Alias: node.Alias,
Features: testFeatures,
}
// We require all aliases within the graph to be unique for our