multi: add version to models.ChannelEdgeInfo
And set it to V1 version everywhere. Add a Version field to ChannelEdgeInfo to distinguish between v1 and v2 channel announcements. Set it to GossipVersion1 for all existing channels. Both KV and SQL stores now validate that only v1 channels are currently supported, returning an error for v2 channels. The KV store automatically sets version to v1 when deserializing (since all persisted channels in KV format are v1). This versioning is essential for handling the different field requirements and validation logic between v1 and v2 channels.
This commit is contained in:
18 files changed
+64
-1
No files matched your search
@@ -493,6 +493,7 @@ func (d *testDBGraph) addRandChannel(node1, node2 *btcec.PublicKey,
|
|||||||
|
|
||||||
chanID := randChanID()
|
chanID := randChanID()
|
||||||
edge := &models.ChannelEdgeInfo{
|
edge := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID.ToUint64(),
|
ChannelID: chanID.ToUint64(),
|
||||||
Capacity: capacity,
|
Capacity: capacity,
|
||||||
Features: lnwire.EmptyFeatureVector(),
|
Features: lnwire.EmptyFeatureVector(),
|
||||||
|
|||||||
@@ -2819,6 +2819,7 @@ func (d *AuthenticatedGossiper) handleChanAnnouncement(ctx context.Context,
|
|||||||
// With the proof validated (if necessary), we can now store it within
|
// With the proof validated (if necessary), we can now store it within
|
||||||
// the database for our path finding and syncing needs.
|
// the database for our path finding and syncing needs.
|
||||||
edge := &models.ChannelEdgeInfo{
|
edge := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: scid.ToUint64(),
|
ChannelID: scid.ToUint64(),
|
||||||
ChainHash: ann.ChainHash,
|
ChainHash: ann.ChainHash,
|
||||||
NodeKey1Bytes: ann.NodeID1,
|
NodeKey1Bytes: ann.NodeID1,
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ func (r *mockGraphSource) GetChannelByID(chanID lnwire.ShortChannelID) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return &models.ChannelEdgeInfo{
|
return &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
NodeKey1Bytes: pubKeys[0],
|
NodeKey1Bytes: pubKeys[0],
|
||||||
NodeKey2Bytes: pubKeys[1],
|
NodeKey2Bytes: pubKeys[1],
|
||||||
}, nil, nil, graphdb.ErrZombieEdge
|
}, nil, nil, graphdb.ErrZombieEdge
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ func TestAddProof(t *testing.T) {
|
|||||||
|
|
||||||
// After utxo was recreated adding the edge without the proof.
|
// After utxo was recreated adding the edge without the proof.
|
||||||
edge := &models.ChannelEdgeInfo{
|
edge := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID.ToUint64(),
|
ChannelID: chanID.ToUint64(),
|
||||||
NodeKey1Bytes: node1.PubKeyBytes,
|
NodeKey1Bytes: node1.PubKeyBytes,
|
||||||
NodeKey2Bytes: node2.PubKeyBytes,
|
NodeKey2Bytes: node2.PubKeyBytes,
|
||||||
@@ -152,6 +153,7 @@ func TestIgnoreChannelEdgePolicyForUnknownChannel(t *testing.T) {
|
|||||||
ctx.chain.addBlock(fundingBlock, chanID.BlockHeight, chanID.BlockHeight)
|
ctx.chain.addBlock(fundingBlock, chanID.BlockHeight, chanID.BlockHeight)
|
||||||
|
|
||||||
edge := &models.ChannelEdgeInfo{
|
edge := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID.ToUint64(),
|
ChannelID: chanID.ToUint64(),
|
||||||
NodeKey1Bytes: pub1,
|
NodeKey1Bytes: pub1,
|
||||||
NodeKey2Bytes: pub2,
|
NodeKey2Bytes: pub2,
|
||||||
@@ -273,6 +275,7 @@ func TestWakeUpOnStaleBranch(t *testing.T) {
|
|||||||
node2 := createTestNode(t)
|
node2 := createTestNode(t)
|
||||||
|
|
||||||
edge1 := &models.ChannelEdgeInfo{
|
edge1 := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID1,
|
ChannelID: chanID1,
|
||||||
NodeKey1Bytes: node1.PubKeyBytes,
|
NodeKey1Bytes: node1.PubKeyBytes,
|
||||||
NodeKey2Bytes: node2.PubKeyBytes,
|
NodeKey2Bytes: node2.PubKeyBytes,
|
||||||
@@ -293,6 +296,7 @@ func TestWakeUpOnStaleBranch(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
edge2 := &models.ChannelEdgeInfo{
|
edge2 := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID2,
|
ChannelID: chanID2,
|
||||||
NodeKey1Bytes: node1.PubKeyBytes,
|
NodeKey1Bytes: node1.PubKeyBytes,
|
||||||
NodeKey2Bytes: node2.PubKeyBytes,
|
NodeKey2Bytes: node2.PubKeyBytes,
|
||||||
@@ -483,6 +487,7 @@ func TestDisconnectedBlocks(t *testing.T) {
|
|||||||
node2 := createTestNode(t)
|
node2 := createTestNode(t)
|
||||||
|
|
||||||
edge1 := &models.ChannelEdgeInfo{
|
edge1 := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID1,
|
ChannelID: chanID1,
|
||||||
NodeKey1Bytes: node1.PubKeyBytes,
|
NodeKey1Bytes: node1.PubKeyBytes,
|
||||||
NodeKey2Bytes: node2.PubKeyBytes,
|
NodeKey2Bytes: node2.PubKeyBytes,
|
||||||
@@ -505,6 +510,7 @@ func TestDisconnectedBlocks(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
edge2 := &models.ChannelEdgeInfo{
|
edge2 := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID2,
|
ChannelID: chanID2,
|
||||||
NodeKey1Bytes: node1.PubKeyBytes,
|
NodeKey1Bytes: node1.PubKeyBytes,
|
||||||
NodeKey2Bytes: node2.PubKeyBytes,
|
NodeKey2Bytes: node2.PubKeyBytes,
|
||||||
@@ -639,6 +645,7 @@ func TestChansClosedOfflinePruneGraph(t *testing.T) {
|
|||||||
node2 := createTestNode(t)
|
node2 := createTestNode(t)
|
||||||
|
|
||||||
edge1 := &models.ChannelEdgeInfo{
|
edge1 := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID1.ToUint64(),
|
ChannelID: chanID1.ToUint64(),
|
||||||
NodeKey1Bytes: node1.PubKeyBytes,
|
NodeKey1Bytes: node1.PubKeyBytes,
|
||||||
NodeKey2Bytes: node2.PubKeyBytes,
|
NodeKey2Bytes: node2.PubKeyBytes,
|
||||||
@@ -1062,6 +1069,7 @@ func TestIsStaleNode(t *testing.T) {
|
|||||||
ctx.chain.addBlock(fundingBlock, chanID.BlockHeight, chanID.BlockHeight)
|
ctx.chain.addBlock(fundingBlock, chanID.BlockHeight, chanID.BlockHeight)
|
||||||
|
|
||||||
edge := &models.ChannelEdgeInfo{
|
edge := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID.ToUint64(),
|
ChannelID: chanID.ToUint64(),
|
||||||
NodeKey1Bytes: pub1,
|
NodeKey1Bytes: pub1,
|
||||||
NodeKey2Bytes: pub2,
|
NodeKey2Bytes: pub2,
|
||||||
@@ -1142,6 +1150,7 @@ func TestIsKnownEdge(t *testing.T) {
|
|||||||
ctx.chain.addBlock(fundingBlock, chanID.BlockHeight, chanID.BlockHeight)
|
ctx.chain.addBlock(fundingBlock, chanID.BlockHeight, chanID.BlockHeight)
|
||||||
|
|
||||||
edge := &models.ChannelEdgeInfo{
|
edge := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID.ToUint64(),
|
ChannelID: chanID.ToUint64(),
|
||||||
NodeKey1Bytes: pub1,
|
NodeKey1Bytes: pub1,
|
||||||
NodeKey2Bytes: pub2,
|
NodeKey2Bytes: pub2,
|
||||||
@@ -1202,6 +1211,7 @@ func TestIsStaleEdgePolicy(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
edge := &models.ChannelEdgeInfo{
|
edge := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID.ToUint64(),
|
ChannelID: chanID.ToUint64(),
|
||||||
NodeKey1Bytes: pub1,
|
NodeKey1Bytes: pub1,
|
||||||
NodeKey2Bytes: pub2,
|
NodeKey2Bytes: pub2,
|
||||||
@@ -1514,6 +1524,7 @@ func parseTestGraph(t *testing.T, useCache bool, path string) (
|
|||||||
// We first insert the existence of the edge between the two
|
// We first insert the existence of the edge between the two
|
||||||
// nodes.
|
// nodes.
|
||||||
edgeInfo := models.ChannelEdgeInfo{
|
edgeInfo := models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: edge.ChannelID,
|
ChannelID: edge.ChannelID,
|
||||||
AuthProof: &testAuthProof,
|
AuthProof: &testAuthProof,
|
||||||
ChannelPoint: fundingPoint,
|
ChannelPoint: fundingPoint,
|
||||||
@@ -1885,6 +1896,7 @@ func createTestGraphFromChannels(t *testing.T, useCache bool,
|
|||||||
// We first insert the existence of the edge between the two
|
// We first insert the existence of the edge between the two
|
||||||
// nodes.
|
// nodes.
|
||||||
edgeInfo := models.ChannelEdgeInfo{
|
edgeInfo := models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: channelID,
|
ChannelID: channelID,
|
||||||
AuthProof: &testAuthProof,
|
AuthProof: &testAuthProof,
|
||||||
ChannelPoint: *fundingPoint,
|
ChannelPoint: *fundingPoint,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/graph/db/models"
|
"github.com/lightningnetwork/lnd/graph/db/models"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestChannelCache checks the behavior of the channelCache with respect to
|
// TestChannelCache checks the behavior of the channelCache with respect to
|
||||||
@@ -101,6 +102,7 @@ func assertHasChanEntries(t *testing.T, c *channelCache, start, end uint64) {
|
|||||||
func channelForInt(i uint64) ChannelEdge {
|
func channelForInt(i uint64) ChannelEdge {
|
||||||
return ChannelEdge{
|
return ChannelEdge{
|
||||||
Info: &models.ChannelEdgeInfo{
|
Info: &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: i,
|
ChannelID: i,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -563,6 +563,7 @@ func TestEdgeInsertionDeletion(t *testing.T) {
|
|||||||
node2Pub, err := node2.PubKey()
|
node2Pub, err := node2.PubKey()
|
||||||
require.NoError(t, err, "unable to generate node key")
|
require.NoError(t, err, "unable to generate node key")
|
||||||
edgeInfo := models.ChannelEdgeInfo{
|
edgeInfo := models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID,
|
ChannelID: chanID,
|
||||||
ChainHash: *chaincfg.MainNetParams.GenesisHash,
|
ChainHash: *chaincfg.MainNetParams.GenesisHash,
|
||||||
AuthProof: &models.ChannelAuthProof{
|
AuthProof: &models.ChannelAuthProof{
|
||||||
@@ -638,6 +639,7 @@ func createEdge(height, txIndex uint32, txPosition uint16, outPointIndex uint32,
|
|||||||
node1Pub, _ := node1.PubKey()
|
node1Pub, _ := node1.PubKey()
|
||||||
node2Pub, _ := node2.PubKey()
|
node2Pub, _ := node2.PubKey()
|
||||||
edgeInfo := models.ChannelEdgeInfo{
|
edgeInfo := models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: shortChanID.ToUint64(),
|
ChannelID: shortChanID.ToUint64(),
|
||||||
ChainHash: *chaincfg.MainNetParams.GenesisHash,
|
ChainHash: *chaincfg.MainNetParams.GenesisHash,
|
||||||
AuthProof: &models.ChannelAuthProof{
|
AuthProof: &models.ChannelAuthProof{
|
||||||
@@ -894,6 +896,7 @@ func createChannelEdge(node1, node2 *models.Node,
|
|||||||
// Add the new edge to the database, this should proceed without any
|
// Add the new edge to the database, this should proceed without any
|
||||||
// errors.
|
// errors.
|
||||||
edgeInfo := &models.ChannelEdgeInfo{
|
edgeInfo := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID,
|
ChannelID: chanID,
|
||||||
ChainHash: *chaincfg.MainNetParams.GenesisHash,
|
ChainHash: *chaincfg.MainNetParams.GenesisHash,
|
||||||
ChannelPoint: outpoint,
|
ChannelPoint: outpoint,
|
||||||
@@ -1775,6 +1778,7 @@ func fillTestGraph(t testing.TB, graph *ChannelGraph, numNodes,
|
|||||||
}
|
}
|
||||||
|
|
||||||
edgeInfo := models.ChannelEdgeInfo{
|
edgeInfo := models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID,
|
ChannelID: chanID,
|
||||||
ChainHash: *chaincfg.MainNetParams.GenesisHash,
|
ChainHash: *chaincfg.MainNetParams.GenesisHash,
|
||||||
AuthProof: &models.ChannelAuthProof{
|
AuthProof: &models.ChannelAuthProof{
|
||||||
@@ -1957,6 +1961,7 @@ func TestGraphPruning(t *testing.T) {
|
|||||||
channelPoints = append(channelPoints, &op)
|
channelPoints = append(channelPoints, &op)
|
||||||
|
|
||||||
edgeInfo := models.ChannelEdgeInfo{
|
edgeInfo := models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID,
|
ChannelID: chanID,
|
||||||
ChainHash: *chaincfg.MainNetParams.GenesisHash,
|
ChainHash: *chaincfg.MainNetParams.GenesisHash,
|
||||||
AuthProof: &models.ChannelAuthProof{
|
AuthProof: &models.ChannelAuthProof{
|
||||||
|
|||||||
@@ -3945,6 +3945,7 @@ func (c *KVStore) FetchChannelEdgesByID(chanID uint64) (
|
|||||||
// party as this is the only information we have about
|
// party as this is the only information we have about
|
||||||
// it and return an error signaling so.
|
// it and return an error signaling so.
|
||||||
edgeInfo = &models.ChannelEdgeInfo{
|
edgeInfo = &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
NodeKey1Bytes: pubKey1,
|
NodeKey1Bytes: pubKey1,
|
||||||
NodeKey2Bytes: pubKey2,
|
NodeKey2Bytes: pubKey2,
|
||||||
}
|
}
|
||||||
@@ -4704,6 +4705,12 @@ func deserializeLightningNode(r io.Reader) (*models.Node, error) {
|
|||||||
func putChanEdgeInfo(edgeIndex kvdb.RwBucket,
|
func putChanEdgeInfo(edgeIndex kvdb.RwBucket,
|
||||||
edgeInfo *models.ChannelEdgeInfo, chanID [8]byte) error {
|
edgeInfo *models.ChannelEdgeInfo, chanID [8]byte) error {
|
||||||
|
|
||||||
|
// We only support V1 channel edges in the KV store.
|
||||||
|
if edgeInfo.Version != lnwire.GossipVersion1 {
|
||||||
|
return fmt.Errorf("only V1 channel edges supported, got V%d",
|
||||||
|
edgeInfo.Version)
|
||||||
|
}
|
||||||
|
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
|
|
||||||
if _, err := b.Write(edgeInfo.NodeKey1Bytes[:]); err != nil {
|
if _, err := b.Write(edgeInfo.NodeKey1Bytes[:]); err != nil {
|
||||||
@@ -4866,6 +4873,9 @@ func deserializeChanEdgeInfo(r io.Reader) (*models.ChannelEdgeInfo, error) {
|
|||||||
edgeInfo models.ChannelEdgeInfo
|
edgeInfo models.ChannelEdgeInfo
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// All channel edges in the KV store are V1.
|
||||||
|
edgeInfo.Version = lnwire.GossipVersion1
|
||||||
|
|
||||||
if _, err := io.ReadFull(r, edgeInfo.NodeKey1Bytes[:]); err != nil {
|
if _, err := io.ReadFull(r, edgeInfo.NodeKey1Bytes[:]); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ import (
|
|||||||
// policy of a channel are stored within a ChannelEdgePolicy for each direction
|
// policy of a channel are stored within a ChannelEdgePolicy for each direction
|
||||||
// of the channel.
|
// of the channel.
|
||||||
type ChannelEdgeInfo struct {
|
type ChannelEdgeInfo struct {
|
||||||
|
// Version is the gossip version that this channel was advertised on.
|
||||||
|
Version lnwire.GossipVersion
|
||||||
|
|
||||||
// ChannelID is the unique channel ID for the channel. The first 3
|
// ChannelID is the unique channel ID for the channel. The first 3
|
||||||
// bytes are the block height, the next 3 the index within the block,
|
// bytes are the block height, the next 3 the index within the block,
|
||||||
// and the last 2 bytes are the output index for the channel.
|
// and the last 2 bytes are the output index for the channel.
|
||||||
|
|||||||
+10
-1
@@ -2038,7 +2038,9 @@ func (s *SQLStore) FetchChannelEdgesByID(chanID uint64) (
|
|||||||
// populate the edge info with the public keys of each
|
// populate the edge info with the public keys of each
|
||||||
// party as this is the only information we have about
|
// party as this is the only information we have about
|
||||||
// it.
|
// it.
|
||||||
edge = &models.ChannelEdgeInfo{}
|
edge = &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
|
}
|
||||||
copy(edge.NodeKey1Bytes[:], zombie.NodeKey1)
|
copy(edge.NodeKey1Bytes[:], zombie.NodeKey1)
|
||||||
copy(edge.NodeKey2Bytes[:], zombie.NodeKey2)
|
copy(edge.NodeKey2Bytes[:], zombie.NodeKey2)
|
||||||
|
|
||||||
@@ -4241,6 +4243,12 @@ func insertChannel(ctx context.Context, db SQLQueries,
|
|||||||
|
|
||||||
v := lnwire.GossipVersion1
|
v := lnwire.GossipVersion1
|
||||||
|
|
||||||
|
// For now, we only support V1 channel edges in the SQL store.
|
||||||
|
if edge.Version != v {
|
||||||
|
return fmt.Errorf("only V1 channel edges supported, got V%d",
|
||||||
|
edge.Version)
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure that at least a "shell" entry for each node is present in
|
// Make sure that at least a "shell" entry for each node is present in
|
||||||
// the nodes table.
|
// the nodes table.
|
||||||
node1DBID, err := maybeCreateShellNode(
|
node1DBID, err := maybeCreateShellNode(
|
||||||
@@ -4458,6 +4466,7 @@ func buildEdgeInfoWithBatchData(chain chainhash.Hash,
|
|||||||
copy(btcKey2[:], dbChan.BitcoinKey2)
|
copy(btcKey2[:], dbChan.BitcoinKey2)
|
||||||
|
|
||||||
channel := &models.ChannelEdgeInfo{
|
channel := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChainHash: chain,
|
ChainHash: chain,
|
||||||
ChannelID: byteOrder.Uint64(dbChan.Scid),
|
ChannelID: byteOrder.Uint64(dbChan.Scid),
|
||||||
NodeKey1Bytes: node1,
|
NodeKey1Bytes: node1,
|
||||||
|
|||||||
@@ -448,6 +448,7 @@ func TestEdgeUpdateNotification(t *testing.T) {
|
|||||||
// Finally, to conclude our test set up, we'll create a channel
|
// Finally, to conclude our test set up, we'll create a channel
|
||||||
// update to announce the created channel between the two nodes.
|
// update to announce the created channel between the two nodes.
|
||||||
edge := &models.ChannelEdgeInfo{
|
edge := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID.ToUint64(),
|
ChannelID: chanID.ToUint64(),
|
||||||
NodeKey1Bytes: node1.PubKeyBytes,
|
NodeKey1Bytes: node1.PubKeyBytes,
|
||||||
NodeKey2Bytes: node2.PubKeyBytes,
|
NodeKey2Bytes: node2.PubKeyBytes,
|
||||||
@@ -642,6 +643,7 @@ func TestNodeUpdateNotification(t *testing.T) {
|
|||||||
require.NoError(t, testFeatures.Encode(testFeaturesBuf))
|
require.NoError(t, testFeatures.Encode(testFeaturesBuf))
|
||||||
|
|
||||||
edge := &models.ChannelEdgeInfo{
|
edge := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID.ToUint64(),
|
ChannelID: chanID.ToUint64(),
|
||||||
NodeKey1Bytes: node1.PubKeyBytes,
|
NodeKey1Bytes: node1.PubKeyBytes,
|
||||||
NodeKey2Bytes: node2.PubKeyBytes,
|
NodeKey2Bytes: node2.PubKeyBytes,
|
||||||
@@ -828,6 +830,7 @@ func TestNotificationCancellation(t *testing.T) {
|
|||||||
ntfnClient.Cancel()
|
ntfnClient.Cancel()
|
||||||
|
|
||||||
edge := &models.ChannelEdgeInfo{
|
edge := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID.ToUint64(),
|
ChannelID: chanID.ToUint64(),
|
||||||
NodeKey1Bytes: node1.PubKeyBytes,
|
NodeKey1Bytes: node1.PubKeyBytes,
|
||||||
NodeKey2Bytes: node2.PubKeyBytes,
|
NodeKey2Bytes: node2.PubKeyBytes,
|
||||||
@@ -904,6 +907,7 @@ func TestChannelCloseNotification(t *testing.T) {
|
|||||||
// Finally, to conclude our test set up, we'll create a channel
|
// Finally, to conclude our test set up, we'll create a channel
|
||||||
// announcement to announce the created channel between the two nodes.
|
// announcement to announce the created channel between the two nodes.
|
||||||
edge := &models.ChannelEdgeInfo{
|
edge := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID.ToUint64(),
|
ChannelID: chanID.ToUint64(),
|
||||||
NodeKey1Bytes: node1.PubKeyBytes,
|
NodeKey1Bytes: node1.PubKeyBytes,
|
||||||
NodeKey2Bytes: node2.PubKeyBytes,
|
NodeKey2Bytes: node2.PubKeyBytes,
|
||||||
|
|||||||
@@ -274,6 +274,7 @@ func (s *Server) ImportGraph(ctx context.Context,
|
|||||||
rpcEdge := rpcEdge
|
rpcEdge := rpcEdge
|
||||||
|
|
||||||
edge := &models.ChannelEdgeInfo{
|
edge := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: rpcEdge.ChannelId,
|
ChannelID: rpcEdge.ChannelId,
|
||||||
ChainHash: *s.cfg.ActiveNetParams.GenesisHash,
|
ChainHash: *s.cfg.ActiveNetParams.GenesisHash,
|
||||||
Capacity: btcutil.Amount(rpcEdge.Capacity),
|
Capacity: btcutil.Amount(rpcEdge.Capacity),
|
||||||
|
|||||||
@@ -306,6 +306,7 @@ var shouldIncludeChannelTestCases = []struct {
|
|||||||
"FetchChannelEdgesByID", mock.Anything,
|
"FetchChannelEdgesByID", mock.Anything,
|
||||||
).Once().Return(
|
).Once().Return(
|
||||||
&models.ChannelEdgeInfo{
|
&models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
NodeKey1Bytes: selectedPolicy,
|
NodeKey1Bytes: selectedPolicy,
|
||||||
},
|
},
|
||||||
&models.ChannelEdgePolicy{
|
&models.ChannelEdgePolicy{
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ func createEdgePolicies(t *testing.T, channel *channeldb.OpenChannel,
|
|||||||
dir2 |= lnwire.ChanUpdateDirection
|
dir2 |= lnwire.ChanUpdateDirection
|
||||||
|
|
||||||
return &models.ChannelEdgeInfo{
|
return &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelPoint: channel.FundingOutpoint,
|
ChannelPoint: channel.FundingOutpoint,
|
||||||
NodeKey1Bytes: pubkey1,
|
NodeKey1Bytes: pubkey1,
|
||||||
NodeKey2Bytes: pubkey2,
|
NodeKey2Bytes: pubkey2,
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ func TestCreateChanAnnouncement(t *testing.T) {
|
|||||||
BitcoinSig2Bytes: expChanAnn.BitcoinSig2.ToSignatureBytes(),
|
BitcoinSig2Bytes: expChanAnn.BitcoinSig2.ToSignatureBytes(),
|
||||||
}
|
}
|
||||||
chanInfo := &models.ChannelEdgeInfo{
|
chanInfo := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChainHash: expChanAnn.ChainHash,
|
ChainHash: expChanAnn.ChainHash,
|
||||||
ChannelID: expChanAnn.ShortChannelID.ToUint64(),
|
ChannelID: expChanAnn.ShortChannelID.ToUint64(),
|
||||||
ChannelPoint: wire.OutPoint{Index: 1},
|
ChannelPoint: wire.OutPoint{Index: 1},
|
||||||
|
|||||||
@@ -329,6 +329,7 @@ func (r *Manager) createEdge(channel *channeldb.OpenChannel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
info := &models.ChannelEdgeInfo{
|
info := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: shortChanID.ToUint64(),
|
ChannelID: shortChanID.ToUint64(),
|
||||||
ChainHash: channel.ChainHash,
|
ChainHash: channel.ChainHash,
|
||||||
Features: lnwire.EmptyFeatureVector(),
|
Features: lnwire.EmptyFeatureVector(),
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ func TestManager(t *testing.T) {
|
|||||||
channelSet: []channel{
|
channelSet: []channel{
|
||||||
{
|
{
|
||||||
edgeInfo: &models.ChannelEdgeInfo{
|
edgeInfo: &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
Capacity: chanCap,
|
Capacity: chanCap,
|
||||||
ChannelPoint: chanPointValid,
|
ChannelPoint: chanPointValid,
|
||||||
},
|
},
|
||||||
@@ -230,6 +231,7 @@ func TestManager(t *testing.T) {
|
|||||||
channelSet: []channel{
|
channelSet: []channel{
|
||||||
{
|
{
|
||||||
edgeInfo: &models.ChannelEdgeInfo{
|
edgeInfo: &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
Capacity: chanCap,
|
Capacity: chanCap,
|
||||||
ChannelPoint: chanPointValid,
|
ChannelPoint: chanPointValid,
|
||||||
},
|
},
|
||||||
@@ -248,6 +250,7 @@ func TestManager(t *testing.T) {
|
|||||||
channelSet: []channel{
|
channelSet: []channel{
|
||||||
{
|
{
|
||||||
edgeInfo: &models.ChannelEdgeInfo{
|
edgeInfo: &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
Capacity: chanCap,
|
Capacity: chanCap,
|
||||||
ChannelPoint: chanPointValid,
|
ChannelPoint: chanPointValid,
|
||||||
},
|
},
|
||||||
@@ -270,6 +273,7 @@ func TestManager(t *testing.T) {
|
|||||||
channelSet: []channel{
|
channelSet: []channel{
|
||||||
{
|
{
|
||||||
edgeInfo: &models.ChannelEdgeInfo{
|
edgeInfo: &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
Capacity: chanCap,
|
Capacity: chanCap,
|
||||||
ChannelPoint: chanPointValid,
|
ChannelPoint: chanPointValid,
|
||||||
},
|
},
|
||||||
@@ -392,6 +396,7 @@ func TestCreateEdgeLower(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
expectedInfo := &models.ChannelEdgeInfo{
|
expectedInfo := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: 8,
|
ChannelID: 8,
|
||||||
ChainHash: channel.ChainHash,
|
ChainHash: channel.ChainHash,
|
||||||
Features: lnwire.EmptyFeatureVector(),
|
Features: lnwire.EmptyFeatureVector(),
|
||||||
@@ -485,6 +490,7 @@ func TestCreateEdgeHigher(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
expectedInfo := &models.ChannelEdgeInfo{
|
expectedInfo := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: 8,
|
ChannelID: 8,
|
||||||
ChainHash: channel.ChainHash,
|
ChainHash: channel.ChainHash,
|
||||||
Features: lnwire.EmptyFeatureVector(),
|
Features: lnwire.EmptyFeatureVector(),
|
||||||
|
|||||||
@@ -346,6 +346,7 @@ func parseTestGraph(t *testing.T, useCache bool, path string) (
|
|||||||
// We first insert the existence of the edge between the two
|
// We first insert the existence of the edge between the two
|
||||||
// nodes.
|
// nodes.
|
||||||
edgeInfo := models.ChannelEdgeInfo{
|
edgeInfo := models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: edge.ChannelID,
|
ChannelID: edge.ChannelID,
|
||||||
AuthProof: &testAuthProof,
|
AuthProof: &testAuthProof,
|
||||||
ChannelPoint: fundingPoint,
|
ChannelPoint: fundingPoint,
|
||||||
@@ -678,6 +679,7 @@ func createTestGraphFromChannels(t *testing.T, useCache bool,
|
|||||||
// We first insert the existence of the edge between the two
|
// We first insert the existence of the edge between the two
|
||||||
// nodes.
|
// nodes.
|
||||||
edgeInfo := models.ChannelEdgeInfo{
|
edgeInfo := models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: channelID,
|
ChannelID: channelID,
|
||||||
AuthProof: &testAuthProof,
|
AuthProof: &testAuthProof,
|
||||||
ChannelPoint: *fundingPoint,
|
ChannelPoint: *fundingPoint,
|
||||||
|
|||||||
@@ -2739,6 +2739,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
|
|||||||
require.NoError(t, err, "unable to create channel edge")
|
require.NoError(t, err, "unable to create channel edge")
|
||||||
|
|
||||||
edge := &models.ChannelEdgeInfo{
|
edge := &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID.ToUint64(),
|
ChannelID: chanID.ToUint64(),
|
||||||
NodeKey1Bytes: pub1,
|
NodeKey1Bytes: pub1,
|
||||||
NodeKey2Bytes: pub2,
|
NodeKey2Bytes: pub2,
|
||||||
@@ -2819,6 +2820,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
|
|||||||
require.NoError(t, err, "unable to create channel edge")
|
require.NoError(t, err, "unable to create channel edge")
|
||||||
|
|
||||||
edge = &models.ChannelEdgeInfo{
|
edge = &models.ChannelEdgeInfo{
|
||||||
|
Version: lnwire.GossipVersion1,
|
||||||
ChannelID: chanID.ToUint64(),
|
ChannelID: chanID.ToUint64(),
|
||||||
Features: lnwire.EmptyFeatureVector(),
|
Features: lnwire.EmptyFeatureVector(),
|
||||||
AuthProof: nil,
|
AuthProof: nil,
|
||||||
|
|||||||
Reference in new issue
Block a user