Skip to content

Qt: defer Spark GUI callbacks during validation - #1950

Draft
reubenyap wants to merge 3 commits into
masterfrom
codex/qt-spark-batch-responsive
Draft

Qt: defer Spark GUI callbacks during validation#1950
reubenyap wants to merge 3 commits into
masterfrom
codex/qt-spark-batch-responsive

Conversation

@reubenyap

@reubenyap reubenyap commented Sep 7, 2026

Copy link
Copy Markdown
Member

PR intention

Alternative to #1940 for the Qt freeze during Spark batch verification. Long validation holds cs_main, while the queued incoming-fund scan, auto-mint activation check, and Spark address-book refresh can wait for that lock on the GUI thread.

Code changes brief

Use existing TRY_LOCK and Qt timer patterns to defer these automatic callbacks. The startup scan and each busy address-book page retry after MODEL_UPDATE_DELAY (250 ms); auto-mint retries on its next timer tick. Address choices remain intact while busy. Each page retries independently because the shared refresh may finish when another page succeeds.

Two production files, 25 additions and 3 deletions. Core proof verification remains serialized, preserving master's historical batching and recent-block verification behavior. Independent of #1940, based on master 4f0c771462b2f327e3a7ff7bf2532bc33c727713; deferred-proof drain and recovery-marker improvements remain separate work.

Qt regression tests cover chain/wallet lock contention, automatic retries without another block notification, and preservation of address choices.

Integration with #1914 at 425c6db was checked in an isolated test merge. Production code merges cleanly. Resolve the two conflicts in src/qt/test/CMakeLists.txt and src/qt/test/test_main.cpp by retaining both test suites and #1914's resource/settings setup. The combined GUI has not been built or exercised.

Validation at 82c9f8f (CI run):

  • Linux Debug and RelWithDebInfo builds passed. cd build && ctest --output-on-failure passed 94/94 tests in each, including test_firo-qt. qa/pull-tester/rpc-tests.py -extended passed in both configurations.
  • Windows and macOS CMake builds passed in both configurations. Jenkins branch validation passed. Four Guix jobs passed; the Windows Guix job is still at Install Guix.
  • git diff origin/master...HEAD --check and git merge-tree --write-tree --messages origin/master origin/pr1950-thorough-review passed against the current base. The resolved Qt: Redesign wallet UI with light/dark theme support #1914 integration diff check also passed.

Local Qt development files are unavailable, so no local GUI build/test was run. A live batch-sync GUI run has not been reproduced. Keep this draft until the reported hang is verified fixed; these callbacks are not proven to be its only cause.

Use try-locks in the queued incoming-fund scan, automatic mint check and
Spark address-book refresh so they do not block the GUI on cs_main.
Retry the startup scan and retain address choices while refresh is busy.

Keep Spark proof verification serialized and preserve historical batching.
Add Qt regressions for lock contention and the deferred scan retry.

Alternative to #1940 for the GUI responsiveness issue.
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

@reubenyap

Copy link
Copy Markdown
Member Author

@CodeAnt-AI review

@codeant-ai

codeant-ai Bot commented Sep 8, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR cf87a06 Sep 08, 2026 · 02:36 02:38

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Sep 8, 2026
@codeant-ai

codeant-ai Bot commented Sep 8, 2026

Copy link
Copy Markdown

User description

PR intention

Alternative to #1940 for the Qt freeze during Spark batch verification. Long validation holds cs_main, while the queued incoming-fund scan, auto-mint activation check, and Spark address-book refresh can wait for that lock on the GUI thread. Defer these automatic callbacks when validation is busy.

Code changes brief

Use existing TRY_LOCK and Qt timer patterns. The startup scan retries after MODEL_UPDATE_DELAY; the periodic auto-mint check retries on its next tick; address-book refresh preserves its current choices and returns false so the existing block-tip path retries. Core proof verification stays serialized, with master's historical batching and recent-block verification behavior preserved.

Two production files, 21 additions and 3 deletions. Qt regression tests cover chain/wallet lock contention, retry without another block notification, and preservation of address choices. Independent of #1940, based on master 4f0c771462b2f327e3a7ff7bf2532bc33c727713; the base branch's deferred-proof drain and recovery-marker limitations remain separate work.

Validation: git diff --cached --check passed. Local GUI configuration failed because the Qt development package (6.7.3 or newer) is unavailable. The new test_firo-qt cases and a live batch-sync GUI run have not been run. This draft identifies concrete blocking callbacks from source; it does not establish that these are the only causes of the reported freeze. Require Qt CI and reproduction of the reported hang before replacing #1940.

Local configuration command (PowerShell, MSYS2 UCRT compiler on PATH):

C:\msys64\ucrt64\bin\cmake.exe -G Ninja -S . -B build-qt -DCMAKE_C_COMPILER=C:/msys64/ucrt64/bin/cc.exe -DCMAKE_CXX_COMPILER=C:/msys64/ucrt64/bin/c++.exe -DCMAKE_MAKE_PROGRAM=C:/msys64/ucrt64/bin/ninja.exe -DCMAKE_BUILD_TYPE=Debug -DBUILD_GUI=ON -DBUILD_TESTS=ON -DBUILD_GUI_TESTS=ON -DWITH_ZMQ=OFF -DWITH_QRENCODE=OFF -DWITH_DBUS=OFF

CodeAnt-AI Description

Keep the Qt interface responsive while Spark validation is running

What Changed

  • Incoming-fund scanning, automatic mint checks, and Spark address updates no longer wait for busy validation operations on the interface thread.
  • Deferred startup scans retry automatically without requiring a new block or transaction notification.
  • Address selections remain unchanged when an update is deferred, and refresh on the next block-tip update.
  • Added regression coverage for chain and wallet lock contention across these Spark actions.

Impact

✅ Fewer Qt freezes during Spark validation
✅ Automatic incoming-fund scans recover without new notifications
✅ Address choices remain intact during busy updates

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Comment thread src/qt/addressbookpage.cpp Outdated
AddressBookPage requires a QWidget parent argument. Supply nullptr in the
Spark GUI contention test so the Linux Qt test target compiles.
A shared refresh can finish when another page succeeds. Schedule the busy
page's retry directly so its address choices still update, and verify the
retry without another block notification.

@reubenyap reubenyap left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No additional actionable issues were found at 82c9f8f5c628d7b9f16a54eee15ce698b3ff91cf.

I traced the three GUI callbacks through their callers and lock ordering, checked timer lifetimes, retry behavior, and address-choice preservation, reviewed the contention tests and existing discussion, and confirmed the current Linux Debug/RelWithDebInfo Qt tests passed. git diff --check also passes.

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

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant