@@ -3337,29 +3337,28 @@ func TestAddChannelEdgeShellNodes(t *testing.T) {
3337
3337
// To start, we'll create two nodes, and only add one of them to the
3338
3338
// channel graph.
3339
3339
node1 := createTestVertex (t )
3340
- if err := graph .AddLightningNode (node1 ); err != nil {
3341
- t .Fatalf ("unable to add node: %v" , err )
3342
- }
3340
+ require .NoError (t , graph .SetSourceNode (node1 ))
3343
3341
node2 := createTestVertex (t )
3344
3342
3345
3343
// We'll now create an edge between the two nodes, as a result, node2
3346
3344
// should be inserted into the database as a shell node.
3347
3345
edgeInfo , _ := createEdge (100 , 0 , 0 , 0 , node1 , node2 )
3348
- if err := graph .AddChannelEdge (& edgeInfo ); err != nil {
3349
- t .Fatalf ("unable to add edge: %v" , err )
3350
- }
3346
+ require .NoError (t , graph .AddChannelEdge (& edgeInfo ))
3351
3347
3352
3348
// Ensure that node1 was inserted as a full node, while node2 only has
3353
3349
// a shell node present.
3354
3350
node1 , err := graph .FetchLightningNode (node1 .PubKeyBytes )
3355
3351
require .NoError (t , err , "unable to fetch node1" )
3356
- if ! node1 .HaveNodeAnnouncement {
3357
- t .Fatalf ("have shell announcement for node1, shouldn't" )
3358
- }
3352
+ require .True (t , node1 .HaveNodeAnnouncement )
3359
3353
3360
3354
node2 , err = graph .FetchLightningNode (node2 .PubKeyBytes )
3361
3355
require .NoError (t , err , "unable to fetch node2" )
3362
3356
require .False (t , node2 .HaveNodeAnnouncement )
3357
+
3358
+ // Show that attempting to add the channel again will result in an
3359
+ // error.
3360
+ err = graph .AddChannelEdge (& edgeInfo )
3361
+ require .ErrorIs (t , err , ErrEdgeAlreadyExist )
3363
3362
}
3364
3363
3365
3364
// TestNodePruningUpdateIndexDeletion tests that once a node has been removed
0 commit comments