Repository navigation
Coordinate concurrent wallet receipts and complete broadcast results - #1066
Merged
ty-everett merged 4 commits intoOct 13, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
BraydenLangley
marked this pull request as ready for review
October 13, 2026 21:00
BraydenLangley
requested review from
sirdeggen,
tonesnotes and
ty-everett
as code owners
October 13, 2026 21:00
ty-everett
approved these changes
Oct 13, 2026
ty-everett
deleted the
codex/wallet-toolbox-acceptance-status-20261013
branch
October 13, 2026 21:12
17 of 20 tasks
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.



Program and scope
unknownresult; overlapping receipts can also count one on-chain output twice or credit it before broadcast succeeds.0263a6566df547f7a89f07fce8a38c9ca4094ed1.Root causes and resulting behavior
updateReqsFromAggregateResultspreserves a durable request that has already advanced tounminedorcompleted, but previously returned before copying the provider result into the foreground response.aggregateActionResultsthen encounteredunknownand threw after the recipient transaction header was committed. A retry could succeed because it took the existing-transaction path. The fix copies the actual provider status and competing-transaction evidence before that guard. Negative broadcast results still reject and do not credit new recipient outputs.Separately,
internalizeActionread for an existing user/TXID before its writer transaction. Two instances could both see no row, create separate transaction headers, and store the same user/outpoint twice because the old output constraint was keyed by transaction ID. A synthetic two-connection MySQL reproduction of one mined 5,000-satoshi payment returned two acceptances and a 10,000-satoshi local balance. Another interleaving let a second receive merge a committed header and credit the output while the first broadcast was pending; the first broadcast later failed. These are same-recipient, same-database failures; neither requires two people to act at once, and neither creates a second on-chain payment. All reproduction wallets, keys, payments, proofs, and broadcast results were synthetic.SQL storage now acquires a database-backed
(userId, txid)receipt claim before selecting the target transaction. A database-clock lease and owner token fence an interrupted or superseded attempt. Ownership outputs and claim completion commit together; the completed key persists to coordinate later merges. A committed header from a failed first broadcast retains a retry marker, so the next attempt rebroadcasts before crediting outputs; an unrelated existing no-send merge still follows its prior path. The migration adds only the receipt-claim table. It preserves historical transaction and output rows, including duplicates, and does not attempt financial-record repair. Existing ambiguous historical receipts remain a separate reconciliation task. IndexedDB does not use this SQL claim.Operational boundary
This is not yet qualified for production. Local independent-connection MySQL is not a PXC multiwriter/failover exercise. Older serving pods do not honor claims, so the rollout needs an explicit mixed-version receipt-traffic plan. Back up and preflight the database, qualify staging on the deployed PXC topology, then use the protected package/image release and staging-first promotion. Historical duplicate rows should be audited and reconciled separately; the claim migration does not rewrite them. This PR does not repair earlier partial receipts or the separate Message Box acknowledgement symptom.
Impact
Patch candidates:
@bsv/wallet-toolbox,@bsv/wallet-toolbox-client, and@bsv/wallet-toolbox-mobile2.14.9. There is no public API, wire-format, runtime-target, or dependency-range change. SQL storage has a schema migration.Verification
pnpm health:check,pnpm lint,pnpm format:check,pnpm typecheck, andpnpm audit:securitypassed. The focused receipt, migration, and broadcast suites passed 39 tests. The repository's patch-coverage calculator reports 90.58% (125/138 changed line/branch points) from these focused suites alone against the 90% target.REPEATABLE READandREAD COMMITTEDnow return one accepted new receipt plus one idempotent merge, one transaction, one output, and the correct 5,000-satoshi balance. During a pending negative broadcast, neither request credits an output and both reject. The old behavior was reproduced before this correction. The test database is disposable and synthetic.0263a6566df547f7a89f07fce8a38c9ca4094ed1is terminal and green: 36 successful checks, seven expected scope-based skips accepted by the merge gate, and 93.48% patch coverage (129/138 changed line/branch points).Security and dependencies
Release and completion
Maintainer review and source merge may proceed after approval and required checks; merge does not publish a package or deploy a service. Hold package/image publication and live promotion until PXC topology and mixed-version rollout gates are complete.