lnd icon indicating copy to clipboard operation
lnd copied to clipboard

Draft: Only log insufficient bandwidth warnings if the htlc fails

Open SachinMeier opened this issue 3 years ago • 1 comments

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:

  1. Have multiple channels to a peer, only one with lots of local balance, the others with low local balance
  2. Receive forwarding request towards peer for amount that can only be satisfied by one of the channels.
  3. Ensure that no "insufficient balance" warning is logged. Debug logs should still appear for each of the low-balance channels.

Failure Case:

  1. Have multiple channels to a peer, only one with lots of local balance, the others with low local balance
  2. Receive a forwarding request towards peer for amount greater than your largest channel.
  3. 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

📝 Please see our Contribution Guidelines for further guidance.

SachinMeier avatar Jul 22 '22 06:07 SachinMeier

There are some logical issues with this PR. see: https://github.com/lightningnetwork/lnd/issues/5972#issuecomment-1192269290 Any advice/comments welcome

SachinMeier avatar Jul 22 '22 07:07 SachinMeier