Closed JssDWt closed 1 month ago
[!IMPORTANT]
Auto Review Skipped
Auto reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yaml
file in this repository. To trigger a single review, invoke the@coderabbitai review
command.You can disable this status message by setting the
reviews.review_status
tofalse
in the CodeRabbit configuration file.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
I'm not entirely sure how to test. Ideally I'd like to run an integration test where 2 nodes have a channel open. Then stop one of the nodes, delete the edge from the database and run the node again. getchaninfo
should fail. Then run the node again with the new flag. getchaninfo
should then succeed.
Not sure how to access the node's database in the test though, with all the different backends available.
Do we know the root cause of this issue, like why it's missing in the first place?
It happens mostly on zero conf private channels. Also at least one public channel on our node is affected. I don't know what causes this. I assume it has to do with a peer disconnect during the initial channel setup process.
Another option is to add the missing edge in the default case here if the edge was not updated, but the channel exists, what do you think @yyforyongyu?
There's a few ways to go with this PR
updatechanpolicy
to set a fee. That way you'll be able to fix missing edges manually by calling updatechanpolicy
. This seems like a fine solution to me.Please provide some guidance on what I should do.
Thanks for digging into this! Left some comments in the original issue, I still want to understand why it happened, to make sure we are not hiding the underlying problem by re-populating the policy. Meanwhile,
- Make a different PR that inserts a missing edge if it's not found when trying to updatechanpolicy to set a fee. That way you'll be able to fix missing edges manually by calling updatechanpolicy. This seems like a fine solution to me.
I'd prefer this option, with a new param in the updatechanpolicy
request, sth like RecreateEdgePolicy
. This way we can mitigate this issue while staying aware of it.
@yyforyongyu I had made a PR for inserting the edge in updatexhanpolicy here https://github.com/lightningnetwork/lnd/pull/8805. I'll add the flag there. Can you do a review round on that, especially around the way the edge will eventually be persisted?
@jssdwt, remember to re-request review from reviewers when ready
Think it's replaced by #8805, feel free to re-open if otherwise.
Change Description
Some channels missed corresponding edges in the graph database. This had a few implications:
lncli getchaninfo
would return "edge not found"lncli updatechanpolicy
would fail to the edge missingThis commit adds a flag to LND startup:
repopulate-missing-edges
. When LND is started with this flag, any missing edges will be prefilled in the database with the default routing policy. This allows the user to later update the channel policy of these channels.Note that 784dc8d530713d9209ba92f3ec7477ed0bfc27f2 partly addresses the issue for new channels, but old channels were still affected by this issue.
Fixes https://github.com/lightningnetwork/lnd/issues/7261
Steps to Test
I'm not entirely sure how to test this properly yet. Have a database where the channel edge is missing.
lncli getchaninfo
should fail. Then run LND with therepopulate-missing-edges
flag. It should fix the issue.Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]
in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.