mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-04 02:36:17 +02:00
routing: reject channel announcement if connected vertexes are unknown
This commit modifies the processing in the routing package eo new announcements. Previously, if we cgot a cnew channel announcement but didn’t yet know of the verses that the chanell connected, the cnnounacment would be accepted. This behavior was eronoues as if the channel were to be queried for, the DB query would fail as we would be unable to retrieve the two nodes involved int he channel. To avoid such an error case, we will now _reject_ any channel announcements in which we don’t yet have a valid node announcement for the connected nodes. This case has been inserted into the handling of channel announcement, a new test has been added, and finally older tests have also been updated to ensure that nodes are added to the database _before_ the edge is.
This commit is contained in:
@@ -602,10 +602,16 @@ func TestChannelCloseNotification(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create test node: %v", err)
|
||||
}
|
||||
if err := ctx.router.AddNode(node1); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
node2, err := createTestNode()
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create test node: %v", err)
|
||||
}
|
||||
if err := ctx.router.AddNode(node2); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Finally, to conclude our test set up, we'll create a channel
|
||||
// announcement to announce the created channel between the two nodes.
|
||||
|
Reference in New Issue
Block a user