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

Fix invalid_commit_sig issue when expecting tx_signatures #536

Merged
merged 6 commits into from
Sep 22, 2023

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Sep 22, 2023

If we disconnect before receiving our peer's tx_signatures, we expect them to re-send it on reconnection (by filling the next_funding_txid field in channel_reestablish). In that case, our peer may also retransmit their corresponding commit_sig first (if they cannot be sure that we've received it). If we've already received that commit_sig, we should ignore it. But we must make sure we don't end up ignoring other commit_sig messages!

Eclair wasn't spec-compliant and wouldn't retransmit their tx_signatures if the transaction was already confirmed. We need to fix this on the eclair side (PR incoming). The issue is that lightning-kmp ended up ignoring unrelated commit_sig messages, which could eventually lead to an invalid_commit_sig error and a force-close.

Extract the faulty lightning message or watch event.
If our peer asks us to retransmit our `tx_signatures`, we should do it even
if the transaction is already confirmed.
When expecting a retransmission of `tx_signatures`, we should ignore the
`commit_sig` they send just before if we've already received it. The right
way to check that we've already received it is to compare its signature
to our latest commitment transaction.
@t-bast t-bast requested a review from pm47 September 22, 2023 07:50
pm47
pm47 previously approved these changes Sep 22, 2023
Copy link
Member

@pm47 pm47 left a comment

Choose a reason for hiding this comment

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

Nice, that was a subtle 🐛 .

@t-bast t-bast merged commit 9f281a2 into master Sep 22, 2023
2 checks passed
@t-bast t-bast deleted the fix-unsigned-funding-ignored-commit-sig branch September 22, 2023 15:11
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.

2 participants