lnd icon indicating copy to clipboard operation
lnd copied to clipboard

localchans: recreate missing edge if not found

Open JssDWt opened this issue 8 months ago • 21 comments

Change Description

Description of change / link to associated issue.If a node contains a channel, but doesn't have a corresponding edge in the graph database, updating the channel policy would fail. In this commit the edge is recreated if the channel exists. This ensures a node can recover from a missing edge in the graph database by calling updatechanpolicy.

Alternative for https://github.com/lightningnetwork/lnd/pull/8768, namely option 2 in https://github.com/lightningnetwork/lnd/pull/8768#issuecomment-2143799767 Partially fixes https://github.com/lightningnetwork/lnd/issues/7261 by allowing to recreate the edge by calling updatechanpolicy.

Steps to Test

  • Create a node that has a channel with a missing edge
  • Calling getchaninfo on this channel will fail
  • Call updatechanpolicy on this channel
  • Calling getchaninfo on this channel should succeed

I'm not sure how to create an integration test where I can modify the graph database to delete an edge in order to test this. Please advise.

Pull Request Checklist

Testing

  • [x] Your PR passes all CI checks.
  • [x] Tests covering the positive and negative (error paths) are included.
  • [x] Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

📝 Please see our Contribution Guidelines for further guidance.

JssDWt avatar Jun 03 '24 10:06 JssDWt