Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTLC number mismatch fixes #920

Merged
merged 4 commits into from
Mar 23, 2018

Conversation

halseth
Copy link
Contributor

@halseth halseth commented Mar 22, 2018

This PR attempts to fix a number of issues that would arise because we allowed creating and receiving HTLC signatures that didn't match the number of HTLC outputs on the commitment.

Fixes #547

halseth added 4 commits March 22, 2018 14:58
This commit fixes an out of bounds error that would occur in the case
where we received a new commitment where the accompanying HTLC sigs were
too few. Now we'll just reject such an commitment.

A test exercising the behavior is also added.
This commit fixes an issue where we would blindly accept a commitment
which came without any accompanying HTLC signatures. A test exercising
the scenario is added.
This commit fixes an issue which would arise in some cases when the
local and remote dust limits would differ, resulting in lnd not
producing the expected number of HTLC signatures. This was a result of
checking dust against the local instead of the remote dust limit.

A test exercising the scenario is added.
This commit adds a check that will make LightningChannel reject a
received commitment if it is accompanied with too many HTLC signatures.
This enforces the requirement in BOLT-2, saying:

if num_htlcs is not equal to the number of HTLC outputs in the local commitment transaction:
    * MUST fail the channel.

A test exercising the behaviour is added.
@halseth halseth force-pushed the dustlimit-remote-fix branch from 17d79be to a6e7dce Compare March 22, 2018 13:58
@Roasbeef Roasbeef mentioned this pull request Mar 22, 2018
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 👾

Strange that this took so long for us to detect, but shows the advantages of having hetegrnemus implementations on the network.

Excellent job with the commit structure! It made the set of changes easy to follow due to the constructive nature of the fix, and accompanying failing test case.

@Roasbeef Roasbeef merged commit daf542c into lightningnetwork:master Mar 23, 2018
@halseth halseth deleted the dustlimit-remote-fix branch July 10, 2018 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Commit signature numer mismatch
2 participants