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

Remove spurious interactive-tx commit_sig retransmission #2966

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Dec 13, 2024

We fully implement lightning/bolts#1214 to stop retransmitting commit_sig when our peer has already received it. We also correctly set next_commitment_number to let our peer know whether we have received their commit_sig or not.

Note that if our peer hasn't upgraded and always sends next_commitment_number = current_commitment_number + 1 even when they haven't received our commit_sig, this won't lead to a force-close: we will simply wait for them to send an error, which will never happen. Their channel will be stuck until they upgrade and send next_commitment_number = current_commitment_number.

This change must only be merged once:

@t-bast t-bast marked this pull request as draft December 13, 2024 09:18
@t-bast t-bast force-pushed the avoid-spurious-commit-sig-retransmit-reconnect branch from e3cf443 to c713beb Compare January 30, 2025 13:59
@t-bast t-bast force-pushed the avoid-spurious-commit-sig-retransmit-reconnect branch from c713beb to 8f586d5 Compare February 19, 2025 16:05
We fully implement lightning/bolts#1214 to stop
retransmitting `commit_sig` when our peer has already received it. We
also correctly set `next_commitment_number` to let our peer know whether
we have received their `commit_sig` or not.

We also retransmit `tx_signatures` (and, if requested, `commit_sig`)
after sending `channel_ready` in the 0-conf case. This was missing and
was a bug.
@t-bast t-bast force-pushed the avoid-spurious-commit-sig-retransmit-reconnect branch from 8f586d5 to 9625a6e Compare March 3, 2025 09:10
@t-bast t-bast marked this pull request as ready for review March 5, 2025 13:49
@t-bast t-bast requested review from remyers and pm47 March 5, 2025 13:49
pm47
pm47 previously approved these changes Mar 5, 2025
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.

That's subtle, hard to be sure all combinations are correctly handled, but LGTM.

@@ -1082,6 +1082,11 @@ object InteractiveTxSigningSession {
liquidityPurchase_opt: Option[LiquidityAds.PurchaseBasicInfo]) extends InteractiveTxSigningSession {
val commitInput: InputInfo = localCommit.fold(_.commitTx.input, _.commitTxAndRemoteSig.commitTx.input)
val localCommitIndex: Long = localCommit.fold(_.index, _.index)
// This value tells our peer whether we need them to retransmit their commit_sig on reconnection or not.
val reconnectNextLocalCommitmentNumber: Long = localCommit match {
case Left(commit) => commit.index
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

Suggested change
case Left(commit) => commit.index
case Left(unsignedCommit) => unsignedCommit.index

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in 426f55a

@@ -1082,6 +1082,11 @@ object InteractiveTxSigningSession {
liquidityPurchase_opt: Option[LiquidityAds.PurchaseBasicInfo]) extends InteractiveTxSigningSession {
val commitInput: InputInfo = localCommit.fold(_.commitTx.input, _.commitTxAndRemoteSig.commitTx.input)
val localCommitIndex: Long = localCommit.fold(_.index, _.index)
// This value tells our peer whether we need them to retransmit their commit_sig on reconnection or not.
val reconnectNextLocalCommitmentNumber: Long = localCommit match {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: the meaning of this value is independent of the reconnection context

Suggested change
val reconnectNextLocalCommitmentNumber: Long = localCommit match {
val nextLocalCommitmentNumber: Long = localCommit match {

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in 426f55a

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