Repository navigation
fix(send): retry a payment-request preview that was refused for syncing - #1714
Merged
Merged
Conversation
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.
Issue being fixed or feature implemented
On 12.0.1-beta a scanned payment request failed with
L1 funding gate closed: SDK L1 filter scan is still short of the chain tipwhile the wallet was seconds from the tip, and every further tap on Send showed the same error until the request was scanned again.Scope. This PR does not change when a send is allowed (the SDK scan must be at the chain tip) and adds no wait anywhere. It only lets a payment-request preview that was refused for syncing be built again. Letting a catch-up through is a separate change, #1721, stacked on this one.
History. Earlier versions of this branch waited up to 30 s for the sync gate, first in every send and then only in the preview. That wait is removed in 7afc44d: it added time in which an invoice could expire or an earlier payment could settle before the build.
What was done?
Supporting changes:
SendCoinsTaskRunnertypes a closed funding gate reported by the deferred build asSendEngineNotSyncedException, so the screens can tell it from other failures. The builds' gate messages use the sharedL1_FUNDING_GATE_CLOSED_REASONprefix for that.PaymentProtocolViewModel.retryPreviewretries only a preview refused asSendEngineNotSyncedException. A rebuilt preview returns to the fee confirmation; nothing is submitted without a new confirmation.That a retry was asked for is kept in the ViewModel, and its refusal is taken only by a resumed screen (from the observer and from
onResume), so the dialog is shown after a rotation, including one that happens while the screen is paused.SendEngineNotSyncedExceptionmoved tocommon, so the payment-request screen and the gift card dialog show the same copy as the send screen.An unbound wallet is refused as on the base, and is not offered the retry.
A tap on Send submits only the preview it was made on: a tap made on a refused preview can rebuild it, but its PIN result cannot submit the rebuilt payment (9f85f85).
A preview that finishes building after the screen closed releases its own reservation (2ab1814). This covers the first build as well as the retry.
If the screen closes while the SDK build is still inside the funding lock, the lock exits cancelled and the finished payment never reaches the ViewModel.
SdkL1SendServicenow releases that reservation itself (4d48e8b). The Maya deposit build reserves the same way and uses the same helper.The retry fetches the payment request again (c0cd58c). It runs the path opening the invoice takes: GET, trust check, earlier-payment lookup, build. A failed fetch drops the request the screen held and shows the screen's usual connection error; a changed request is shown and has to be confirmed again. An authentication that answers after such a failed fetch is ignored (54e4f71), and the screen's observers read the request once per update, so a request dropped mid-update cannot crash them (90fcc58).
Known and not addressed:
An earlier attempt kept the earlier payment in the screen's memory (eeeae79, 5a6d44c, 32a21ff). It is reverted in c0cd58c: the wallet's records cannot tell a reissued order from another order of the same merchant.
How Has This Been Tested?
SdkL1SendServiceTest,PaymentProtocolViewModelRetryPreviewTest,PayTapActionTest,SendCoinsTaskRunnerBIP70Test,CutoverSendRouteTest(pass on_testNet3Debug).finally). Two rounds on the re-fetch change; the last, at 54e4f71, lists the payee that still serves a paid invoice (above). Clean at 90fcc58.Breaking Changes
None.
Checklist:
🤖 Generated with Claude Code