Skip to content

Commit 76c8ac8

Browse files
committed
server: directly add missing edge to graph DB
With the graph refactor work done in the last release, some extra validation in the graph Builder has resurfaced the bug. So here we just let the "add missing edge" logic directly route through to the graph DB instead of going through the graph Builder where the extra checks are. the extra check in question is setting the funding script so that the chain view can then be updated - but i dont think this is important for our own channels since this chainview is used to know when a channel can be pruned from the graph (we would not prune our own channels anyways).
1 parent 0a2a5b2 commit 76c8ac8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

routing/localchans/manager.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ type Manager struct {
5050
error)
5151

5252
// AddEdge is used to add edge/channel to the topology of the router.
53+
//
54+
// NOTE: this is only used to recreate our own missing edges during
55+
// policy updates. This is a workaround for the following issue:
56+
// https://github.com/lightningnetwork/lnd/issues/7261
5357
AddEdge func(ctx context.Context, edge *models.ChannelEdgeInfo) error
5458

5559
// policyUpdateLock ensures that the database and the link do not fall

server.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
11281128
DefaultRoutingPolicy: cc.RoutingPolicy,
11291129
ForAllOutgoingChannels: func(ctx context.Context,
11301130
cb func(*models.ChannelEdgeInfo,
1131-
*models.ChannelEdgePolicy) error,
1131+
*models.ChannelEdgePolicy) error,
11321132
reset func()) error {
11331133

11341134
return s.graphDB.ForEachNodeChannel(ctx, selfVertex,
@@ -1148,7 +1148,11 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
11481148
AddEdge: func(ctx context.Context,
11491149
edge *models.ChannelEdgeInfo) error {
11501150

1151-
return s.graphBuilder.AddEdge(ctx, edge)
1151+
// AddEdge is only called for our own local channels, so
1152+
// we skip the extra validation done by the graph
1153+
// builder here and instead write the edge directly to
1154+
// the graph database.
1155+
return s.graphDB.AddChannelEdge(ctx, edge)
11521156
},
11531157
}
11541158

0 commit comments

Comments
 (0)