Merge pull request #10017 from ellemouton/strictTypeForChanFeatures

refactor+multi: use *lnwire.FeatureVector for ChannelEdgeInfo features
This commit is contained in:
Oliver Gugger authored and GitHub committed 2025-07-02 19:59:47 +02:00
commit 8a03414190
14 files changed
+70 -78

No files matched your search

+1 -8
View File
@@ -305,13 +305,6 @@ func (r *Manager) createEdge(channel *channeldb.OpenChannel,
channelFlags = 1
}
var featureBuf bytes.Buffer
err := lnwire.NewRawFeatureVector().Encode(&featureBuf)
if err != nil {
return nil, nil, fmt.Errorf("unable to encode features: %w",
err)
}
// We need to make sure we use the real scid for public confirmed
// zero-conf channels.
shortChanID := channel.ShortChanID()
@@ -323,7 +316,7 @@ func (r *Manager) createEdge(channel *channeldb.OpenChannel,
info := &models.ChannelEdgeInfo{
ChannelID: shortChanID.ToUint64(),
ChainHash: channel.ChainHash,
Features: featureBuf.Bytes(),
Features: lnwire.EmptyFeatureVector(),
Capacity: channel.Capacity,
ChannelPoint: channel.FundingOutpoint,
}
+2 -2
View File
@@ -387,7 +387,7 @@ func TestCreateEdgeLower(t *testing.T) {
expectedInfo := &models.ChannelEdgeInfo{
ChannelID: 8,
ChainHash: channel.ChainHash,
Features: []byte{0, 0},
Features: lnwire.EmptyFeatureVector(),
Capacity: 9,
ChannelPoint: channel.FundingOutpoint,
NodeKey1Bytes: sp,
@@ -475,7 +475,7 @@ func TestCreateEdgeHigher(t *testing.T) {
expectedInfo := &models.ChannelEdgeInfo{
ChannelID: 8,
ChainHash: channel.ChainHash,
Features: []byte{0, 0},
Features: lnwire.EmptyFeatureVector(),
Capacity: 9,
ChannelPoint: channel.FundingOutpoint,
NodeKey1Bytes: rp,
+2
View File
@@ -348,6 +348,7 @@ func parseTestGraph(t *testing.T, useCache bool, path string) (
ChannelID: edge.ChannelID,
AuthProof: &testAuthProof,
ChannelPoint: fundingPoint,
Features: lnwire.EmptyFeatureVector(),
Capacity: btcutil.Amount(edge.Capacity),
}
@@ -677,6 +678,7 @@ func createTestGraphFromChannels(t *testing.T, useCache bool,
AuthProof: &testAuthProof,
ChannelPoint: *fundingPoint,
Capacity: testChannel.Capacity,
Features: lnwire.EmptyFeatureVector(),
NodeKey1Bytes: node1Vertex,
BitcoinKey1Bytes: node1Vertex,
+2
View File
@@ -2741,6 +2741,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
NodeKey2Bytes: pub2,
BitcoinKey1Bytes: pub1,
BitcoinKey2Bytes: pub2,
Features: lnwire.EmptyFeatureVector(),
AuthProof: nil,
}
require.NoError(t, ctx.graph.AddChannelEdge(ctxb, edge))
@@ -2816,6 +2817,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
edge = &models.ChannelEdgeInfo{
ChannelID: chanID.ToUint64(),
Features: lnwire.EmptyFeatureVector(),
AuthProof: nil,
}
copy(edge.NodeKey1Bytes[:], node1Bytes)