graph: fix graph-cache issue#10378
Merged
bhandras merged 3 commits intolightningnetwork:masterfrom Nov 19, 2025
Merged
Conversation
…abled Fix a bug where channels with both policies disabled were not added to the graph cache during startup. When a policy update later re-enabled one of the directions, the update would succeed in the database but fail to update the graph cache (since the channel structure was never added), preventing the channel from being used for routing.
2b6b9fc to
696d61a
Compare
Collaborator
Author
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request provides a well-reasoned fix for a subtle bug in the graph cache. The issue, where channels with initially disabled policies were not cached correctly, is resolved by ensuring the channel structure is always added. The changes in graph/db/graph_cache.go are clear and effective. My main feedback is to add a regression test to prevent this issue from resurfacing in the future. I've also included a minor formatting suggestion for the new release notes file.
Collaborator
|
Looks good! Could you please cover this case with a small test? So we don't accidentally regress. |
4e7a1de to
0ed4503
Compare
Member
|
Pending linter fix, otherwise can be merged! |
0ed4503 to
4f40d45
Compare
Roasbeef
added a commit
that referenced
this pull request
Nov 19, 2025
Backport graph cache fix #10378 to minor release branch
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Problem (Before the Fix)
Initial Population:
When a Policy Update Arrives Later:
channel, ok := c.nodeChannels[nodeKey][policy.ChannelID]
if !ok {
log.Warnf("Channel=%v not found in graph cache", policy.ChannelID)
return // ← Channel never gets added!
}
Why AddEdge Won't Help:
You're also correct that Builder.addEdge() won't re-add it because:
The Fix (After the Commit)
The fix correctly:
Fixes: #10342