@@ -4063,3 +4063,45 @@ func TestClosedScid(t *testing.T) {
4063
4063
require .Nil (t , err )
4064
4064
require .True (t , exists )
4065
4065
}
4066
+
4067
+ // testNodeAnn is a serialized node announcement message which contains an
4068
+ // address type (6) that LND is not aware of.
4069
+ var testNodeAnn = "01012674c2e7ef68c73a086b7de2603f4ef1567358df84bb4edaa06c" +
4070
+ "f2132965b14e2434faab04170f0089216accbd79188fa3d40dbb0438bd89782cae" +
4071
+ "27cc656bf60007800088082a69a2625e7a2a024b9a1fa8e006f1e3937f65f66c40" +
4072
+ "8e6da8e1ca728ea43222a7381df1cc449605024b9a424c554549524f4e2d76302e" +
4073
+ "31312e307263332d362d67663963613934650000001d0180c7caa8260702240061" +
4074
+ "80000000d0000000005cd2a001260706204c"
4075
+
4076
+ // TestLightningNodePersistence takes a raw serialized node announcement
4077
+ // message, converts it to our internal models.LightningNode type and attempts
4078
+ // to persist this to disk.
4079
+ //
4080
+ // NOTE: Currently, this tests demonstrates that we are _unable_ to do this if
4081
+ // the node announcement has an address type unknown to LND. This will be fixed
4082
+ // in an upcoming commit.
4083
+ func TestLightningNodePersistence (t * testing.T ) {
4084
+ t .Parallel ()
4085
+
4086
+ // Create a new test graph instance.
4087
+ graph , err := MakeTestGraph (t )
4088
+ require .NoError (t , err )
4089
+
4090
+ nodeAnnBytes , err := hex .DecodeString (testNodeAnn )
4091
+ require .NoError (t , err )
4092
+
4093
+ // Use the raw serialized node announcement message create an
4094
+ // lnwire.NodeAnnouncement instance.
4095
+ msg , err := lnwire .ReadMessage (bytes .NewBuffer (nodeAnnBytes ), 0 )
4096
+ require .NoError (t , err )
4097
+ na , ok := msg .(* lnwire.NodeAnnouncement )
4098
+ require .True (t , ok )
4099
+
4100
+ // Convert the wire message to our internal node representation.
4101
+ node := models .NodeFromWireAnnouncement (na )
4102
+
4103
+ // Attempt to persist the node to disk. This currently fails due to the
4104
+ // unknown address type.
4105
+ err = graph .AddLightningNode (node )
4106
+ require .ErrorContains (t , err , "address type cannot be resolved" )
4107
+ }
0 commit comments