Skip to content

embedded: apply a ready confirmation before finality - #201

Merged
darioAnongba merged 1 commit into
mainfrom
darioAnongba/embedded-tracker-event-order
Nov 16, 2026
Merged

darioAnongba merged 1 commit into
mainfrom
darioAnongba/embedded-tracker-event-order

Conversation

@darioAnongba

Copy link
Copy Markdown
Collaborator

The embedded engine's transfer tracker waits on a host's Confirmed, Reorged and Done channels in one select, which runs a random case when several are ready. A host whose channels are buffered can have a confirmation and Done ready together, for example when the engine resumes a transfer long after it confirmed. On main, the tracker then receives Done first 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 Done for a transfer whose confirmation is not applied, it takes a confirmation that is ready on Confirmed, 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 Confirmed and Done. A host must still deliver Reorged on its own, with no other event ready, and the ConfirmationEvents comment states both rules. waved (lightninglabs/wavelength#1583) offers one event at a time on unbuffered channels, so it already meets them.

TestTransferResumeFinal resumes a pending transfer 32 times on a test chain that holds the confirmation and Done at registration. It fails on main.

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 darioAnongba self-assigned this Nov 16, 2026
@darioAnongba
darioAnongba marked this pull request as ready for review November 16, 2026 16:17
@darioAnongba
darioAnongba merged commit 53efd48 into main Nov 16, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from 🆕 New to ✅ Done in Taproot-Assets Project Board Nov 16, 2026
@darioAnongba
darioAnongba deleted the darioAnongba/embedded-tracker-event-order branch November 16, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

1 participant