Repository navigation
embedded: apply a ready confirmation before finality - #201
Merged
Merged
Conversation
A host can have a transfer's confirmation and Done ready at the same time, and the tracker receives from the two channels in no fixed order. When it receives Done for a transfer whose confirmation is not applied, it takes the confirmation that is ready on the Confirmed channel, writes the proofs and then marks the transfer final. The ConfirmationEvents comment states the event order a host can rely on.
darioAnongba
marked this pull request as ready for review
November 16, 2026 16:17
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The embedded engine's transfer tracker waits on a host's
Confirmed,ReorgedandDonechannels in oneselect, which runs a random case when several are ready. A host whose channels are buffered can have a confirmation andDoneready together, for example when the engine resumes a transfer long after it confirmed. On main, the tracker then receivesDonefirst about half of the time, fails with "confirmation of ... became final before it was applied" and retries 30 seconds later with the same odds. The transfer's proofs stay unwritten until a retry happens to receive the confirmation first.With this change, when the tracker receives
Donefor a transfer whose confirmation is not applied, it takes a confirmation that is ready onConfirmed, writes the proofs, and then marks the transfer final. If no confirmation is ready, it returns the same error and retries.The change covers only the order of
ConfirmedandDone. A host must still deliverReorgedon its own, with no other event ready, and theConfirmationEventscomment states both rules. waved (lightninglabs/wavelength#1583) offers one event at a time on unbuffered channels, so it already meets them.TestTransferResumeFinalresumes a pending transfer 32 times on a test chain that holds the confirmation andDoneat registration. It fails on main.