Skip to content

lnwallet: fix payment regression introduced by MayAddOutgoingHtlc#5478

Merged
Roasbeef merged 2 commits into
lightningnetwork:masterfrom
Roasbeef:fix-may-add-htlc
Jul 7, 2021
Merged

lnwallet: fix payment regression introduced by MayAddOutgoingHtlc#5478
Roasbeef merged 2 commits into
lightningnetwork:masterfrom
Roasbeef:fix-may-add-htlc

Conversation

@Roasbeef
Copy link
Copy Markdown
Member

@Roasbeef Roasbeef commented Jul 6, 2021

In this PR, we fix a payment regression introduced by #5355. The newly added MayAddOutgoingHtlc method uses the min HTLC value to add a "mock HTLC" to see if any constraints are violated. However in practice, it's possible that an implementation sends over a min HTLC amount of 0 mSAT. This would cause us to add a zero value HTLC, which would then trigger the ErrInvalidHTLCAmt error, causing the bandwidth hints for the link to show up as "zero".

The initial fix is straight forward: ensure zero is never used.

The proper fix here is to use the actual HTLC amount as discuseed in #5355.

Fixes #5468.

@Roasbeef Roasbeef added wallet The wallet (lnwallet) which LND uses commitments Commitment transactions containing the state of the channel channel management The management of the nodes channels bug fix labels Jul 6, 2021
@Roasbeef Roasbeef added this to the 0.13.1 milestone Jul 6, 2021
@Roasbeef Roasbeef requested review from Crypt-iQ and guggero July 6, 2021 23:49
Roasbeef added 2 commits July 6, 2021 16:50
As is, if the remote party proposes a min HTLC of 0 `mSat` to us, then
we won't ever be able to _send outgoing_ in the channel as the
`MayAddOutgoingHtlc` will attempt to add a zero-value HTLC, which isn't
allowed within the protocol.

The default channels created actually already use a min HTLC value of
zero within the tests, so this test case fails as is.
In this commit, in order to allow the test added in the prior commit to
pass, we'll increment the mockHTLCAmt value by 1 to ensure we never
attempt to add a zero value HTLC.

Fixes lightningnetwork#5468
@Roasbeef Roasbeef force-pushed the fix-may-add-htlc branch from 2fd194d to af43a86 Compare July 6, 2021 23:50
Copy link
Copy Markdown
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK, can confirm that I no longer get the FAILURE_REASON_INSUFFICIENT_BALANCE error when trying to do a circular rebalance through a channel with c-lightning.

@Roasbeef Roasbeef merged commit 9c9f821 into lightningnetwork:master Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix channel management The management of the nodes channels commitments Commitment transactions containing the state of the channel wallet The wallet (lnwallet) which LND uses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Channel unusable: FAILURE_REASON_INSUFFICIENT_BALANCE

3 participants