Skip to content

Merge master into feat/kotlin-sdk-phase-1 (v11.9.1, DashSpend lost-reply recovery ported to SDK) - #1616

Merged
HashEngineering merged 6 commits into
feat/kotlin-sdk-phase-1from
merge/master-into-kotlin-sdk-phase-1-v11.9.1
Oct 27, 2026
Merged

HashEngineering merged 6 commits into
feat/kotlin-sdk-phase-1from
merge/master-into-kotlin-sdk-phase-1-v11.9.1

Conversation

@HashEngineering

@HashEngineering HashEngineering commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Merges master into feat/kotlin-sdk-phase-1, bringing master's 4 commits (v11.9.1) onto the Kotlin SDK Phase 1 branch.

Draft. It's a draft because of the #1560 port (below). Master's lost-merchant-reply recovery runs on dashj, and phase-1 sends BIP70 through the SDK, so it was rewritten onto the SDK path rather than dropped. That is new payments code nobody has reviewed, and it has known gaps listed under Open questions. It needs review and a testnet run against CTX staging before this leaves draft.

Where the diff size comes from (what to review)

The merge adds +9,312 / −729 lines against feat/kotlin-sdk-phase-1. Almost all of it is master's own content, already reviewed on master:

Area Lines added Source
Strings / resources +2,674 Mostly v11.9.1 translations across all locales
Tests +3,768 Mostly master's own tests (#1560 alone brings 3,370)
Payments source +1,936 Mostly master's #1560 as written
Everything else +934 v11.9.1 fixes, invite links, gift-card fix

#1560 by itself is +5,735 / −380 on master (3,370 of it tests).

Lines written during conflict resolution (git show --remerge-diff 28f6b74f1, i.e. lines that match neither side) total about +1,390. Of those, about 600 are payments source, and that is the new code to focus on:

File Lines added
payments/SendCoinsTaskRunner.kt +202
payments/PendingDirectPaymentVerifier.kt +140
payments/PendingPaymentEngine.kt (new) 121
common/.../SendPaymentService.kt +43
PaymentProtocolViewModel, DashSpendViewModel, FakeDashSpendService, AppModule, SendPaymentServiceExt, WalletSendPaymentService small wiring

About 740 of the resolution lines are tests, mainly SendCoinsTaskRunnerBIP70Test (+271, rewritten for the SDK harness) and PendingDirectPaymentVerifierTest (+150, SDK engine cases). The rest is the username and invite merges.

What's coming from master

Commit
fedb593e4 fix(dash-spend): flexible gift cards shown as fixed; blank locations screen without Google Play Services (#1556)
3b5079b97 fix(dashspend): recover a payment whose merchant reply is lost (#1560)
ef552d410 fix: v11.9.1 with bug fixes (#1567)
a8de1f079 fix(dashpay): share invite links the iOS wallet can open (#1587)

Preserving master's fixes

I checked this mechanically: every line master added in bde52b520..a8de1f079 is either in the merge result, ported, or deliberately dropped below.

Build config

  • build.gradle: both sides already had dashj 22.0.5 and dpp 4.0.1. This branch's dashSdkVersion is kept.
  • wallet/build.gradle: kept this branch's 12000019 / 12.0.0-sync. Master's 11.9.1 would move a v12 branch backwards. minSdk 29 is unchanged.

AppDatabase

  • Master added TransactionRecordsDao and one accessor, but no schema change. It sits beside this branch's instantSendLockDao().
  • Schema stays at 22, and no migrations were added or renumbered.
  • The DAO keys moved from Sha256Hash to TxId to match this branch's entities. Room's compile-time query check and the real-Room TransactionRecordsDaoTest pass.

#1560, ported onto the SDK send path

  • New payments/PendingPaymentEngine.kt. The PendingPaymentEngine interface and SdkPendingPaymentEngine give the verifier what it needs from the SDK: whether the engine has observed the tx (L1SendProbeService.observedTxContext), whether the cutover has committed, a commit through SdkBridgedTransactionFactory, and broadcast or release of the SDK reservation.

  • PendingDirectPaymentVerifier keeps master's design:

    • quarantine, persistence and the awaitRestored barrier
    • grace and release, plus retention
    • forgetTransaction and the wipe guards
    • unresolvedSubmissionFor

    Differences on the SDK path:

    • The verifier holds the SDK reservation while it watches.
    • Seeing the tx on the network also counts the engine's observation.
    • After the cutover, it uses isSynced() instead of the dashj peer count. That peer group never connects after the cutover, so without this, payments would never release.
  • SendCoinsTaskRunner was rebuilt from this branch's version, with master's submission semantics ported in:

    • NonCancellable submission, an OkHttp client with no retries, and a one-shot body
    • quarantine before the POST
    • only DNS or connect failures release the reservation; anything else, a nack included, stays pending and throws PaymentSubmissionPendingException
    • gift-card attribution before the quarantine is cancelled
    • awaitRestored on every payment entry point

    This branch's 20s awaitServerBroadcastObserved rescue is removed, because the verifier now does that job. Bip70AckedDisplayException now extends PaymentSubmissionPendingException.

  • Neutral API. PaymentSubmissionPendingException is open and carries a hex txId. There is a new PaymentRecoveryMetadata. payWithDashUrl* and payAndGetTxId take recovery and a suspend (String) onTransactionCreated. Master's originWallet: Wallet parameter is gone, because dashj types can't cross into feature modules; the runner captures the wallet itself.

  • DashSpend. Submission state, payAndRecordOrder and the suspending saveGiftCardDummy were ported to String/TxId. PurchaseGiftCardConfirmDialog is master's file with this branch's neutral-type edits re-applied.

  • PaymentProtocolViewModel: the duplicate-invoice guard runs before the prebuilt SDK reservation is submitted, and gives the reservation back when the invoice is already outstanding.

BlockchainServiceImpl

  • Kept:
    • master's extra 60s cleanup wait, through awaitPreviousInstanceCleanup
    • the deadlock reschedule, after the §37 process-exit check
    • the memory-pressure reschedule, using shouldStopForMemoryPressure levels
    • peer-count updates
  • Dropped: scheduleRecoveryRestart / cancelRecoveryRestart and BlockchainServiceRecoveryAlarmTest. Master's alarm uses request code 1, the same PendingIntent as this branch's ALARM_REQUEST_CODE_RESTART, so it would replace it. This branch's replay-restart alarm, with its retire policy and cancel-on-wipe, already covers it.
  • Dropped: isMixingOrPaused and master's notification hunk. CoinJoin is removed here, and that code moved into updateSyncNotification.

v11.9.1 lock screen / activities

  • onCreateWithWallet was already ported on this branch.
  • Master's duplicate finishedWithoutWallet is folded into this branch's finishedForNoWallet.
  • Ported: the lock-screen gap fix (setupKeyboardBottomMargin, hasNavBar, layout and dimens) and the isInitialized guard in TransactionResultActivity.onDestroy.

Username request

  • Kept this branch's fail-closed, token-guarded availability check.
  • Ported from master:
    • handling of finished votes: locked → blocked, no winner → available, won → taken
    • checkedUsername / hasAvailableResultFor
    • usernameBlocked in usernameSubmitButtonState
  • Master's job-cancel is superseded by the token.

Invites (#1587)

  • InvitationLinkData keeps the shielded variant and gains looksLikeUrl.
  • The OneLink generator uses master's InviteShareLink long link with single encoding. One leftover double-encode was removed.
  • InviteCreatedFragment shares shieldedLink ?: viewModel.shareLink.

Kept deleted

  • CoinJoinService, CoinJoinActivity, NetworkMonitorActivity and CoinJoinMixingStartTest. Mixing was removed in 83ce13ca1, and the network monitor is SDK-backed in fe04cc120.
  • SendCoinsViewModelAssetLockTest, because signAndSendAssetLock was removed (Buy Credits is SDK-only).

Tests

  • InvitationLinkDataTest, RequestUserNameViewModelTest (add/add): both suites merged. Master's username cases were moved onto this branch's harness.
  • SendCoinsTaskRunnerBIP70Test: rewritten on the SDK harness, with 9 new cases for master's semantics. 7 new verifier cases cover the SDK engine.
  • PaymentProtocolDuplicateSubmissionTest / PaymentProtocolViewModelRaceTest: rewritten for the SDK flow.
  • DashSpendSubmissionStateTest: ported, minus master's two originWallet tests.
  • Master's new Robolectric tests: pinned to sdk = [29].

Open questions (why this is a draft)

  1. Restart gap in the fix(dashspend): recover a payment whose merchant reply is lost #1560 port. The SDK has no API to reserve an outpoint again, and its reservation is lost when the process dies or the TTL runs out. After a restart, only the dashj mirror locks come back. That means an SDK send can select the inputs of a payment that's still pending, which gives a conflicting tx, not a double payment. The persisted record, the pending UI, the duplicate-invoice and gift-card blocks, and a late commit or attribution do survive a restart. Accept this, or ask for an SDK outpoint-lock API?
  2. Behaviour change. A nack, or any HTTP error after the request is sent, no longer releases the reservation or offers a retry; it shows "Payment status unknown". This is master's semantics. Bip70AckedDisplayException now shows that same generic message, which is slightly off for an acked payment that couldn't be shown.
  3. Plain dash: URI gift cards after the cutover (PiggyCards). The SDK builds, signs and sends in one step, so the order is recorded after the broadcast. A process death in that window loses the order. Fixing it means routing these sends through the SDK's deferred build.
  4. Post-cutover release relies on isSynced() plus a recent chain tip, because the dashj peer count means nothing then. That's a judgement call.
  5. forgetTransaction only checks the dashj wallet. The verifier asks the engine before discarding anything, and DashSpend calls forgetTransaction only when nothing was sent.
  6. Minor:
    • WalletApplication.hasWallet() merged in from master but has no caller.
    • Master's wallet/CHANGES v11.9.1 entry merged in as-is.

Verification

  • Compile: :wallet:compile_testNet3DebugKotlin and :wallet:compileProdDebugKotlin pass, as do both variants' Java/Hilt compilation and their unit-test compilation, unit-test compilation for common, exploredash, uphold, coinbase, crowdnode and maya, and :integration-android / :sample-integration-android.
  • Unit tests: the full suites (wallet, common, exploredash, uphold, coinbase, crowdnode, maya) ran 3037 tests with 0 failures on the first merged run. On the final tree, wallet ran 2790 with 1 failure: PlatformSyncEngineRestartTest > resume_isRearmableAcrossRepeatedStopRestartCycles. It is pre-existing and flaky: it fails 2/2 in isolation on unmerged phase-1 and passed in the first merged run.
  • Targeted suites all pass:
    • SendCoinsTaskRunnerBIP70Test 24, SendCoinsTaskRunnerSdkRoutingTest 7, SendCoinsTaskRunnerSelfSpendGraceTest 3, SendCoinsTaskRunnerTest 2
    • PendingDirectPaymentVerifierTest 42, PendingDirectPaymentWipeTest 10, PendingDirectPaymentConfigTest 27
    • TransactionRecordsDaoTest 3
    • InvitationLinkDataTest 15, InviteShareLinkTest 7
    • RequestUserNameViewModelTest 68
    • WalletTransactionMetadataProviderGiftCardTest 9, WalletTransactionMetadataProviderObserveTest 5
    • PaymentProtocolDuplicateSubmissionTest 2, PaymentProtocolViewModelRaceTest 3
    • exploredash 49
  • How the tests were run: locally, with -Drobolectric.conscryptMode=OFF. Without it, every Robolectric test fails with no conscrypt_jni both before and after the merge. Nothing in the repo was changed for this.
  • ktlint: ktlintCheck passes. It covers exploredash, crowdnode, maya and uphold only.
  • Not run: instrumented or on-device tests, and the testnet/CTX staging run of the fix(dashspend): recover a payment whose merchant reply is lost #1560 flow.

feat/kotlin-sdk-phase-1 has since gained #1613, a one-line dark-mode label fix in a file this merge doesn't touch, so it still merges cleanly.

🤖 Generated with Claude Code

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants