Repository navigation
fix: keep held hardware sends until resolved - #1210
ben-kaufman wants to merge 8 commits into
Conversation
The hardware broadcast has no deadline, so a late answer is never dropped. A plain send whose broadcast failed without proof that nothing was sent keeps its signed transaction, shows as pending until the wallet sees its txid, and is never sent again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A hardware send is written to a persisted store before its broadcast and kept until the broadcast succeeds or proves nothing was sent, or the wallet sees its transaction. Until then the same send is refused from any sheet or launch and shows as pending, and a store that cannot be read refuses the send before signing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A held send whose outcome is unknown can be broadcast again as signed, from its pending screen or by retrying the same payment; nothing is ever signed again. It is released only when the refusal proves the transaction can never confirm (it breaks consensus, an output can never relay, or a fresh read shows a coin spent by another final transaction) and the wallet has not seen it. A refusal that leaves a valid transaction keeps it pending. A broadcast that outlives its deadline moves to the pending screen while its late answer still lands. Held sends are read one by one, so an unreadable entry only refuses its own wallet and is never dropped. A send is released only after its payment is recorded, and an observed send completes on its pending screen, which can then be dismissed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every hand-off of a held send's signed bytes is counted app-wide and persisted first. A "not sent" answer releases the send only when no other broadcast of the same bytes began since, is still running, or was taken, and the bytes are not broadcast again from any sheet while one broadcast of them is running. A retry of a send the wallet has already seen shows it as pending, where it is recorded and completed, instead of signing it again. Shop payments wait for their broadcast's answer. Only consensus failures release a held send; relay-policy refusals such as dust keep it, and newer Bitcoin Core consensus codes are read. The spend check reads a bounded number of transactions and proves nothing beyond that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Shop hardware payment also stops waiting on its broadcast after the screen deadline and shows as uncertain, while the broadcast finishes. Its late answer goes where an earlier one would: a success to the proof flow, a refusal to the retained candidate. The same bytes are not broadcast again from the sheet until that answer lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A held hardware send the wallet has seen is recorded, with the tags and contact it was sent with, and released at launch and as wallet activity arrives. Retrying a payment the wallet has already seen asks whether to send it again instead of showing it as sent, and only counts it seen while the wallet still has that transaction rather than one that replaced it. A broadcast of a held send's bytes that never answers stops blocking another after two minutes and counts as possibly sent, so it never releases the payment. A refused rebroadcast says when another is still running. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Broadcast Again that finds its send released in the meantime checks again whether the wallet has seen it, and moves to success if so, rather than saying the payment was not sent. It reports the payment can be made again only when it was proven never to have gone out. A Shop payment whose broadcast succeeds after the screen deadline now completes on its sign screen as an in-time success does. The already-sent prompt drops the date when it cannot be read, a new amount clears a stale unresolved send, and a broadcast that never answers stops blocking another about two minutes after it started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@ben-kaufman synonymdev/bitkit-android#1952 and #1350 (for #1657 / #1079) make an on-chain send compare the fee of the transaction prepared after the swipe with the fee shown on Confirm. If it is higher, nothing is broadcast and the user re-approves that same transaction. Those PRs leave hardware-wallet sends out because this PR and its twin rework that path. Could this one and its twin be parked for now? Then I would extend #1952 / #1350 to cover hardware sends too. #1771 / #1773 and #1209 / #1211 can stay as they are; whichever lands second rebases. |
|
@ben-kaufman #1208 (keep signed hardware sends on retry) is now merged. This draft also keeps a signed hardware send whose broadcast may have gone out, so please reconcile it with what landed on |
Twin: synonymdev/bitkit-android#1772
This PR keeps a signed hardware-wallet send whose broadcast outcome is unknown, so the same payment is never signed a second time, and gives such a send a safe way out through broadcasting its own signed bytes again.
Description
Out of Scope
Bitkit/Services/HwHeldBroadcastStore.swift: a held send is not released in the background when its coins are spent elsewhere. That needs the hardware spend watcher from the stuck hardware payment work; here the check runs only when Broadcast Again gets a missing-coin refusal.Design
N/A — no design available.
Preview
N/A
QA Notes
Setup
Journeys
N/A — not drivable; see Manual Tests.
Manual Tests
Automated Checks
HwFundingSignerTests.swift— a plain send with an unknown broadcast outcome is held, cannot be left, and a retry only broadcasts the same bytesHwFundingSignerTests.swift— a held send is refused from another sheet during and after its broadcast, matches its address in any case, does not hold back other payments, and is released once the wallet sees itHwFundingSignerTests.swift— a rebroadcast refused as never confirmable releases the send, which can then be signed afresh; refusals that leave a valid transaction keep the holdHwFundingSignerTests.swift— a missing-coin refusal releases only once a fresh read shows the coin spent elsewhere, never on a failed read or once the wallet has seen the transactionHwFundingSignerTests.swift— a broadcast past its deadline moves to pending, and its late answer keeps or releases the holdHwFundingSignerTests.swift— a late or concurrent "not sent" answer keeps the hold once the same bytes were broadcast again, and the bytes are not broadcast again from any sheet while one broadcast runsHwFundingSignerTests.swift— a retry of a send the wallet has seen asks before signing again and records the earlier one with its tags; seen sends are recorded and released once; a replaced or missing transaction is not seenHwFundingSignerTests.swift— a broadcast that never answers stops blocking after its bound without ever releasing the payment; a wallet wipe clears the held sendsHwFundingSignerTests.swift— a Shop broadcast past its deadline stops the spinner, refuses a retry while it runs, and its late success reaches the proof flow and the sign screen, or its late refusal marks the retained candidateHwFundingSignerTests.swift— Broadcast Again on a send the app just recorded as seen moves to success instead of reporting it not sentHwFundingSignerTests.swift— a successful send stays held until it is recorded; a retry proven not dispatched leaves no hold; an observed unresolved send is recorded once, then released and leavableHwFundingSignerTests.swift— held sends survive a new store, entries from a newer version still hold, an unreadable entry refuses only its own wallet and is kept, and an unreadable store refuses before signingBroadcastConnectivityTests.swift— refusal parsing through core and server envelopes, and that only consensus refusals prove a transaction can never confirmSendConfirmationLifecycleTests.swift— signer built without a broadcast timeout and with its own held storeEvidence
ef4a14053(branch head), iPhone 17e simulator on iOS 26.5, Xcode command line.HwFundingSignerTests,SendConfirmationLifecycleTests,BroadcastConnectivityTests,TransferServiceActivityTests: 128 tests, 0 failures.-only-testing:BitkitTests, skipping UtxoSelectionTests, BlocktankTests, AddressTypeIntegrationTests and RNMigrationCleanupTests, no parallel testing): 3010 tests, 1 skipped, 0 failures.--lint .: 0 files require formatting.node scripts/validate-translations.js: 0 errors; the new strings are filled in all 15 locales.Gaps
Models used
Opus 5.5(reasoning:Not exposed)Opus 5.5(reasoning:Not exposed)Opus 5.5(reasoning:Not exposed)Metadata note: the session does not expose a reasoning setting.