Skip to content

feat(ui): show Locked on immature coinbase reward rows - #854

Merged
romchornyi merged 1 commit into
swift-sdk-integrationfrom
fix/coinbase-reward-locked-state
Jul 22, 2026
Merged

romchornyi merged 1 commit into
swift-sdk-integrationfrom
fix/coinbase-reward-locked-state

Conversation

@romchornyi

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

The "Locked" status label on coinbase reward transaction rows (shown while the reward is still maturing, < 100 confirmations) never appears. Balance/max were unaffected — only the per-row label regressed.

Root cause: Transaction._state only ever returned .processing (mempool) or .ok, so the .locked enum case — rendered as the "Locked" trailing label in HomeView — was never produced. The case existed but was dead.

This is app/SwiftDashSDK-side. The merged app reads state from the SDK-backed Transaction, not DSAccount, so the equivalent DashSync lockedBalance fix has no effect here.

What was done?

  • Carried the mined blockHeight into SDKSnapshot (from PersistentTransaction.blockHeight; 0 for synthetic rows).
  • _state now returns .locked for a confirmed coinbase transaction while fewer than COINBASE_MATURITY (100) blocks sit on top of the minting block — mirroring the legacy DSTransaction.getBlocksToMaturity rule — comparing snapshot.blockHeight against SwiftDashSDKSPVCoordinator.shared.tipHeight.
  • Falls back to .ok when height or tip are unknown (height > 0, tip >= height) so the label never sticks, and it clears once the reward matures since the home feed rebuilds its Transaction wrappers on each reload.

How Has This Been Tested?

Not yet run through a device build (Xcode was open; CLI build skipped to avoid a build.db collision). Recommended testnet smoke: with a coinbase/mining reward younger than 100 confirmations in history, the row should show "Locked"; once it passes 100 confirmations the label should clear. Please also confirm on real data that PersistentTransaction.blockHeight is populated for coinbase rows — if the SDK leaves it 0, the maturity gate won't engage and the source field needs revisiting.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Transaction._state only ever returned .processing or .ok, so the .locked
case (rendered as the "Locked" trailing label on coinbase reward rows) was
never produced — the label regressed to always-absent.

Carry the mined blockHeight into SDKSnapshot and, for a confirmed coinbase
transaction, return .locked while fewer than COINBASE_MATURITY (100) blocks
sit on top of it (mirrors the legacy DSTransaction.getBlocksToMaturity
rule), comparing against SwiftDashSDKSPVCoordinator.tipHeight. Falls back to
.ok when height/tip are unknown so the label never sticks, and clears once
the reward matures (the home feed rebuilds its Transaction wrappers).
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: eaf78577-d71d-4d7b-982b-ccc6ad053500

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/coinbase-reward-locked-state

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@llbartekll llbartekll left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@romchornyi
romchornyi merged commit dab27ed into swift-sdk-integration Jul 22, 2026
1 check passed
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.

3 participants