-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
lnwallet: update RBF state machine w/ latest spec guidelines #9568
Merged
Roasbeef
merged 8 commits into
lightningnetwork:rbf-staging
from
Roasbeef:rbf-staging-state-machine
Mar 6, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
73e622a
lnwallet/chancloser: add fee rate to ClosePending
Roasbeef 7fc6284
lnwallet/chancloser: ignore spurious channel flushed events
Roasbeef b34ff32
lnwire: update closing_complete and closing_sig to latest spec draft
Roasbeef fff99e1
protofsm: update state machine w/ new spec flow
Roasbeef 72642f5
lnwallet: implement special case for OP_RETURN in rbf-coop
Roasbeef 1353b89
lnwallet/chancloser: update RBF state machine to handle early offer case
Roasbeef dacc5df
lnwallet/chancloser: increase test coverage of state machine
Roasbeef f331e2c
protofsm: add an upfront check for SendWhen predicates
Roasbeef File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Isn't this a violation of the spec? Why should we be permissive in accepting something that we should explicitly reject?
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.
Rationale comes from the Robustness Principle: https://en.wikipedia.org/wiki/Robustness_principle. I can remove it ofc, but handling the early send case (they send their first offer before they recv our shutdown reply) can help us save an otherwise aborted flow.
Eclair had this behavior early on when we did interop. I think we need more interop hours/flows to conclude if it's safe to remove or not.
As mentioned, this was a flake in the itests (not added in this PR) that was due to some async send logic (when a send is conditional on some predicate) in the state machine executor. There're a few other options there including:
WaitingForSend
state. Once we issue the send event, we shift into this state, then process another event once the send has finalized.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.
I think if the messages were single-threaded we could not worry about this early stashing logic
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.
What is the lift like here? I really think it's a good idea to have it be single-threaded as I personally find it easier to reason about
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.
On the transport layer the messages order are always guaranteed right?
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.
Yup
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.
They are single threaded. The exception is when you don't want a message to go out unconditionally, instead you want to wait for a condition to be upheld.
I've added a commit to do the first option.
I think it makes sense to still leave this in place, we've seen it pop up once during interop, and we still have 2 implementations to go before we finalize interop with all the major implementations.
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.
Ah, ok I misunderstood how this worked.