Draft: Only log insufficient bandwidth warnings if the htlc fails
Previously, a Warning was logged for each channel link to a peer that had insufficient bandwidth (or violated another policy parameter). This seemed excessive and unhelpful because warnings for insufficient balance would be emitted even for htlcs that were successfully routed (see Issue #5972).
Also make each error case of htlcswitch.channelLink::canSendHtlc emit a DetailedLinkError rather than a LinkError.
Change Description
Description of change / link to associated issue.
Steps to Test
Success:
- Have multiple channels to a peer, only one with lots of local balance, the others with low local balance
- Receive forwarding request towards peer for amount that can only be satisfied by one of the channels.
- Ensure that no "insufficient balance" warning is logged. Debug logs should still appear for each of the low-balance channels.
Failure Case:
- Have multiple channels to a peer, only one with lots of local balance, the others with low local balance
- Receive a forwarding request towards peer for amount greater than your largest channel.
- Ensure that a single "insufficient balance" Warning is logged and it specifies the Channel Point of the channel with large local balance.
Pull Request Checklist
Testing
- [ ] Your PR passes all CI checks.
- [ ] Tests covering the positive and negative (error paths) are included.
- [ ] Bug fixes contain tests triggering the bug to prevent regressions.
Code Style and Documentation
- [x] The change obeys the Code Documentation and Commenting guidelines, and lines wrap at 80.
- [x] Commits follow the Ideal Git Commit Structure.
- [x] Any new logging statements use an appropriate subsystem and logging level.
- [x] There is a change description in the release notes, or
[skip ci]in the commit message for small changes.
📝 Please see our Contribution Guidelines for further guidance.
There are some logical issues with this PR. see: https://github.com/lightningnetwork/lnd/issues/5972#issuecomment-1192269290 Any advice/comments welcome