-
Notifications
You must be signed in to change notification settings - Fork 268
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
base: master
Are you sure you want to change the base?
Conversation
e3cf443
to
c713beb
Compare
c713beb
to
8f586d5
Compare
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.
8f586d5
to
9625a6e
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
case Left(commit) => commit.index | |
case Left(unsignedCommit) => unsignedCommit.index |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
val reconnectNextLocalCommitmentNumber: Long = localCommit match { | |
val nextLocalCommitmentNumber: Long = localCommit match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 426f55a
We fully implement lightning/bolts#1214 to stop retransmitting
commit_sig
when our peer has already received it. We also correctly setnext_commitment_number
to let our peer know whether we have received theircommit_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 ourcommit_sig
, this won't lead to a force-close: we will simply wait for them to send anerror
, which will never happen. Their channel will be stuck until they upgrade and sendnext_commitment_number = current_commitment_number
.This change must only be merged once:
remote_commitment_number
#2965next_commitment_number
during splice reconnect lightning-kmp#736 so that users can upgrade to avoid being stuck