Regular rebasing of the staging branch

bitcoin-core/gui-qml: PR #1145

1 major finding · 13 minor findings · 2 suggestions

Earlier concerns neither republished nor resolved: 1 minor finding · 1 suggestion. See the Run archive for their assessments.

Findings

Link

[major] · Onboarding edits carry over to a different profile selected later

Prune, proxy, listen and server edits survive a directory change in the wizard and are written into the newly selected profile instead of loading that profile's settings.

Location: src/qml/models/onboardingoptionsmodel.cpp:345 (head).

Details and suggested fix

Choose Reduce storage for directory A, go Back, select an existing full-node directory B, and finish onboarding. refreshPreview() preserves user-touched values through applyPreviewValuesPreservingTouched(), while updating the resolved target to B. prepareApplyToArgs() consequently associates A's edits with B, and FinalizeStartupSettings() saves them there. B receives an automatic-pruning override that can prune its retained block data; with txindex=1, startup fails instead. A proxy on/off round trip carries over through the same touched-state mechanism. Clear profile-scoped touched state when the resolved profile identity changes, or retain separate drafts per profile. Add regressions for both the prune choice and the proxy round trip.


Link

[minor] · Onboarding commits settings before checking the profile lock

The QML wizard writes settings to a profile held by another node before startup fails on its lock, extending Widgets' pre-existing prune-only ordering.

Location: src/qml/bitcoin.cpp:288 (head).

Details and suggested fix

FinalizeStartupSettings() applies pending Core choices, writes settings.json, updates GUI stores and persists migration before baseInitialize() checks the directory locks. Selecting a directory owned by a running node can therefore save a prune override and qml_onboarded even though this application cannot start. The running node may adopt those values on restart or overwrite them with its next settings write. Widgets already writes the Intro prune choice before locking, but QML extends this to the other onboarding settings. Acquire the resolved profile lock before committing and retain the pending changes until acquisition succeeds.


Link

[minor] · Conflicting network flags escape the guarded startup path

Launching with conflicting flags such as -regtest -testnet lets an exception escape main instead of returning a configuration error.

Location: src/qml/bitcoin.cpp:250 (head).

Details and suggested fix

The early SetupChainQSettings() call evaluates gArgs.GetChainTypeString() before RunPreInitOnboarding() and common::InitConfig(). GetChainArg() throws std::runtime_error when multiple network selectors are enabled, and neither this call nor main.cpp catches it. InitConfig() would convert the exception into a configuration error, but runs too late. Guard the early lookup and return EXIT_FAILURE through the normal startup-error path, with a regression using conflicting flags.


Link

[minor] · Database-cache validation uses the 8 MiB subcache cap

The QML developer settings reject total dbcache values above 8 MiB, including the ordinary 450 MiB default.

Location: src/qml/models/options_model.h:186 (head).

Details and suggested fix

m_max_dbcache_size_mib uses MAX_COINS_DB_CACHE >> 20, but kernel/caches.h defines that constant as the coins-DB-specific subcache limit, not the total database-cache limit. DeveloperOptions.qml validates edits against this maximum, so entering 450 or 1024 reports a permitted range of 4–8 MiB. Derive the maximum from MAX_DBCACHE_BYTES, clamped to the integer range exposed by the model.


Link

[minor] · parseInt() truncates accepted localized numeric input

In locales accepting 1,000 as a grouped integer, the prune-target editor saves it as 1 GB rather than 1000 GB.

Location: src/qml/components/StorageSettings.qml:78 (head).

Details and suggested fix

ValueInput uses a locale-aware IntValidator, but StorageSettings.onEditingFinished calls parseInt(text) and validates only its result. For accepted text such as 1,000, JavaScript returns 1, pruneTargetError() accepts it, and changePruneSizeGB() saves that target. With automatic pruning enabled, the saved limit used after restart is therefore about 1 GB. The cache and thread editors use the same parsing pattern. Use a shared locale-aware parser that consumes the complete input and rejects malformed text without changing the setting, and cover grouped input in tests.


Link

[minor] · Pre-window startup errors have no GUI presentation

Configuration, finalization and directory-lock failures can terminate a desktop-launched QML application without displaying an explanation.

Location: src/qml/bitcoin.cpp:277 (head).

Details and suggested fix

QmlGuiMain() installs noui_connect() and returns on InitConfig(), FinalizeStartupSettings() and baseInitialize() failures before createWindow() constructs RuntimeDialogModel. Those errors consequently reach only the log and stderr. The unreadable-settings recovery prompt is handled separately, but other configuration errors and a locked directory have no dialog. Widgets displays configuration errors explicitly and creates its window before base initialization. Add a plain-text critical dialog for pre-window failures while preserving stderr output and the failure exit status.


Link

[minor] · Delayed NAT-PMP application can overlap Core shutdown

Enabling NAT-PMP and immediately quitting can leave the 200 ms callback racing the mapping-thread shutdown or starting a thread after its shutdown join.

Location: src/qml/models/options_model.cpp:175 (head).

Details and suggested fix

applyRuntimeCoreChange() schedules m_node.mapPort() with QTimer::singleShot(200, this, ...). The options model has no shutdown stop hook and remains alive while the event loop processes the executor's asynchronous shutdown. The callback can therefore reach StartMapPort(true) while Shutdown() operates on g_mapport_thread, or after StopMapPort() has finished. This permits a data race or a new joinable thread that reaches static destruction without being joined and calls std::terminate. Stop the options model on requestedShutdown, cancel or invalidate pending callbacks, and reject further live changes before queuing Core shutdown.


Link

[minor] · Block-clock history scanning can assert after chain shortening

A trusted invalidateblock or rare shorter higher-work reorganization during the scan can invalidate its captured height range and abort the GUI.

Location: src/qml/models/chainmodel.cpp:83 (head).

Details and suggested fix

setTimeRatioListInitial() captures active_chain_height, then calls getBlockHash(height) through that height. Each backend call locks cs_main separately, and getBlockHash() uses Assert(ActiveChain()[height]). If the active chain becomes shorter between those calls, a later indexed height no longer exists and the assertion aborts the process; other reorganizations can mix timestamps from different chains. Fetch the history as one consistent backend snapshot, or traverse ancestors of a safely captured tip using fallible lookups.


Link

[minor] · Existing writable profiles require unnecessary parent write access

ValidateCustomDataDir() rejects an existing writable directory when its parent is read-only, preventing selection of otherwise usable profiles.

Location: src/qml/datadir.cpp:138 (head).

Details and suggested fix

After checking an existing target's directory type, accessibility and writability, the function still checks target_info.absoluteDir() and requires that parent to be writable. A user-writable profile beneath an administrator-owned, traversable parent therefore fails with “The parent directory is not writable,” although no directory needs creating there. Return success after validating an existing target and reserve the writable-ancestor check for targets that must be created.


Link

[minor] · Onboarding storage estimates ignore the -blocksdir volume

When -blocksdir uses another filesystem, onboarding bases available block storage and pruning recommendations on the data-directory volume instead.

Location: src/qml/models/onboardingoptionsmodel.cpp:247 (head).

Details and suggested fix

requestStorageCheck() selects only m_resolved_data_dir or m_data_dir, and CheckStorageSpace() measures that path's existing ancestor. Although BlocksDirPathNoCreate() resolves -blocksdir, it is used only to detect existing chain data. For a fresh profile with block files on another filesystem, the wizard can permit full storage on an undersized block volume or reject a feasible choice based on the wrong volume. Account for block storage on the resolved -blocksdir volume separately from chainstate, or explicitly warn that this layout is not covered by the estimate.


Link

[minor] · -min is accepted but ignored by the QML window

The QML GUI accepts -min but shows its window normally; no current QML caller passing it was found, and whether existing autostart shortcuts target this executable is unconfirmed.

Location: src/qml/guiargs.cpp:13 (head).

Details and suggested fix

SetupQmlGuiArgs() advertises -min as “Start minimized,” but the QML startup path never reads it. MainWindow.qml restores geometry and unconditionally sets visible = true, so a user explicitly launching with this option still gets the normal window. Apply the minimized or tray-hidden state before the first show, or stop advertising the unsupported option.


Link

[minor] · -test-automation masks preview errors as network errors

Automation launches can report “only available on regtest” for an unreadable settings.json or another preview failure, even with -regtest selected.

Location: src/qml/bitcoin.cpp:150 (head).

Details and suggested fix

The condition test_automation_socket && (!status.ok || status.resolved_chain != "regtest") uses the same message for two different causes. When profile reading fails, ResolveOnboardingStartupStatus() returns the actual error in status.error, but the caller discards it and also bypasses the unreadable-settings recovery below. Handle !status.ok separately, preserving the real diagnostic or recovery path, and reserve the regtest-only message for a successfully resolved non-regtest profile.


Link

[minor] · The QML functional harness leaves Windows GUI settings unisolated

By source inspection, Windows harness launches can read and modify real registry-backed GUI preferences because they omit -test-settings-dir.

Location: test/functional/test_framework/qml_test_harness.py:68 (head).

Details and suggested fix

QmlTestHarness.start() redirects HOME and XDG directories but passes only -datadir, -test-automation and -printtoconsole by default. Those environment changes do not isolate Windows native QSettings, and startup's Persist-mode migration reads and removes keys from those user stores. Local tests can consequently depend on external preferences or change them. Always pass a harness-owned -test-settings-dir; the existing startup helper then selects an isolated INI store for both QML settings and legacy migration.


Link

[minor] · BUILD_GUI changes meaning without corresponding build-guide updates

Existing -DBUILD_GUI=ON configurations now select the node-only QML GUI, while the guides still promise the Widgets GUI's QR support under that option.

Location: CMakeLists.txt:105 (head).

Details and suggested fix

BUILD_GUI now builds the QML bitcoin-qt; the Widgets application is separately selected by the default-off BUILD_GUI_LEGACY and named bitcoin-qt-legacy. WITH_QRENCODE and WITH_DBUS also depend on the legacy option. The QML GUI has no wallet workflows and rejects BIP21 URI arguments, but build-unix.md and build-osx.md still direct users to -DBUILD_GUI=ON with libqrencode for QR support. Document this migration explicitly, including which option retains wallet functionality, the executable names, and the QML/Qt Quick dependencies.


Optional improvements

Link

[suggestion] · Manual pruning is presented as full storage

An editable prune=1 profile appears to use full storage, and directly choosing Store all data does not request prune=0.

Location: src/qml/components/StorageOptions.qml:71 (head).

Details and suggested fix

PruneEnabled() returns false for prune=1, so StorageOptions checks Store all data for a manual-pruning profile. Clicking that card assigns false again, which Session::changePrune() rejects as unchanged without marking the setting touched. Preserving an untouched manual value is correct, but the displayed mode and explicit action are misleading. Represent full, manual and automatic pruning separately, and let an explicit full-storage selection write prune=0, with a redownload warning when applicable.


Link

[suggestion] · Onboarding migration removes the directory remembered by bitcoin-qt-legacy

When onboarding updates the bootstrap directory, cleanup removes legacy strDataDir, so returning to the legacy GUI without -datadir can select the default profile instead.

Location: src/qml/legacy_settings_migration.cpp:514 (head).

Details and suggested fix

FinalizeStartupSettings() selects GuiCleanup::DataDirAndReset when it updates the bootstrap data directory, and ApplyGuiCleanup() removes strDataDir from the legacy store. The still-buildable bitcoin-qt-legacy reads that key in Intro::showIfNeeded() and otherwise falls back to the default directory. Trying the QML GUI can therefore change which profile a subsequent legacy launch opens. Preserve the legacy directory key while copying the selection into the QML store, or explicitly document that this migration is one-way.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.

Background

Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.

Documented decisions

Node settings are shared between the GUI and daemon so that changing pruning, proxy, or port-mapping behavior does not produce different configurations depending on which executable opens the same data directory. Persistence is deliberately selective: copying every effective value into settings.json would prevent subsequent bitcoin.conf changes from taking effect.

The new QML settings and migration paths participate in this shared configuration model, rather than treating node options as independent QSettings preferences. The pinned base and head both establish the precedence order as forced settings, command line, settings.json, network-specific configuration, then default configuration. This history explains why showing an effective value and explicitly overriding it are distinct operations.

Source 1 · Source 2

Onboarding previews must not mutate live startup configuration because configuration can redirect the data directory, causing a later read to resolve a different profile. Reset and persistence were consequently deferred until Core resolves the active directory and network; cancellation should leave settings unchanged, and applying prepared choices should reject a changed target profile.

The QML entry point performs pre-initialization onboarding, retains a PendingApply, calls InitConfig, selects chain-specific QSettings, and only then finalizes settings. The earlier onboarding proposal explicitly documents the reason for this ordering, along with backups and restoration when a later write fails. These are protections against changing a profile other than the one the user selected, not merely startup organization.

Source 1

Prune sizes are presented in whole decimal GB for comprehensibility and to reduce mistakes editing large numbers, while Core stores the target in MiB. Historical discussion explicitly favored rounding the display upward without changing the exact effective target until the user edits it. Later onboarding work also distinguished manual pruning from automatic pruning and preserved existing targets.

The new onboarding page exposes GB-facing storage choices, while its settings structures retain the underlying Core values. This history explains why an existing profile's exact target, a rounded displayed amount, and a newly selected target are not interchangeable. The related onboarding proposal also documents why moving from pruned to full storage warrants a redownload warning.

Source 1 · Source 2 · Source 3

Automatic pruning was designed to reduce retained block and undo-file storage subject to retention constraints, rather than impose a cap on the entire node data directory. Its original proposal explicitly retained recent blocks and required a minimum feasible target.

The QML storage calculation separately adds assumed chainstate size to both full and pruned storage requirements. That separation reflects the historical boundary of the prune target: it is not an estimate of every byte the application needs. The original proposal's numerical values and early networking restrictions are historical context, not assertions about the current backend.

Source 1

GUI responsiveness requires treating directory checks, configuration access, settings writes, and chain queries as potentially blocking work. Earlier QML work explicitly paired worker execution with cached display state, pending/error feedback, rejection of outdated results, and draining workers and notification subscriptions during shutdown.

The pinned application applies this rationale to node initialization and shutdown through QmlInitExecutor, and delivers block/header notifications to ChainSyncModel through queued calls. Its teardown stops models and joins the initialization worker. The historical source explains the responsiveness and lifetime constraints; it does not establish that every operation in this rebased implementation has been moved off the GUI thread.

Source 1

Supporting the project's minimum Qt version constrained onboarding's folder-dialog implementation. Earlier onboarding work explicitly retained a Qt 6.2-compatible dialog alongside the Qt 6.5-and-newer implementation instead of requiring the newer API everywhere.

The changed build configuration continues to request Qt 6.2, and the QML resource build selects separate qt62 or qt65 compatibility resources according to the detected version. This explains the compatibility layer as a supported-version constraint rather than duplicate UI code without purpose.

Source 1