multi: add models.Node V1 constructor

Add a version field to models.Node and a V1 constructor for it.
This commit is contained in:
Elle Mouton authored and yyforyongyu committed 2025-11-12 22:54:05 +08:00
1 parent 8f205e2d1c
commit 80e70096cb
18 files changed
+443 -340

No files matched your search

+21 -17
View File
@@ -228,14 +228,16 @@ func parseTestGraph(t *testing.T, useCache bool, path string) (
return nil, err
}
dbNode := &models.Node{
pubKey, err := route.NewVertexFromBytes(pubBytes)
require.NoError(t, err)
dbNode := models.NewV1Node(pubKey, &models.NodeV1Fields{
AuthSigBytes: testSig.Serialize(),
LastUpdate: testTime,
Addresses: testAddrs,
Alias: node.Alias,
Features: testFeatures,
}
copy(dbNode.PubKeyBytes[:], pubBytes)
Features: testFeatures.RawFeatureVector,
})
// We require all aliases within the graph to be unique for our
// tests.
@@ -564,15 +566,15 @@ func createTestGraphFromChannels(t *testing.T, useCache bool,
features = lnwire.EmptyFeatureVector()
}
dbNode := &models.Node{
AuthSigBytes: testSig.Serialize(),
LastUpdate: testTime,
Addresses: testAddrs,
Alias: alias,
Features: features,
}
copy(dbNode.PubKeyBytes[:], pubKey.SerializeCompressed())
dbNode := models.NewV1Node(
route.NewVertex(pubKey), &models.NodeV1Fields{
AuthSigBytes: testSig.Serialize(),
LastUpdate: testTime,
Addresses: testAddrs,
Alias: alias,
Features: features.RawFeatureVector,
},
)
privKeyMap[alias] = privKey
@@ -1249,10 +1251,12 @@ func runPathFindingWithAdditionalEdges(t *testing.T, useCache bool) {
dogePubKeyBytes, err := hex.DecodeString(dogePubKeyHex)
require.NoError(t, err, "unable to decode public key")
doge := &models.Node{}
copy(doge.PubKeyBytes[:], dogePubKeyBytes[:])
doge.Alias = "doge"
copy(doge.PubKeyBytes[:], dogePubKeyBytes)
pubKey, err := route.NewVertexFromBytes(dogePubKeyBytes)
require.NoError(t, err)
doge := models.NewV1Node(pubKey, &models.NodeV1Fields{
Alias: "doge",
})
graph.aliasMap["doge"] = doge.PubKeyBytes
// Create the channel edge going from songoku to doge and include it in