Regular rebasing of the staging branch

bitcoin-core/gui-qml: PR #1145

Provider refusals

write_verifier: Provider declined the request because of a cybersecurity restriction. Experiments remain incomplete; static verification can continue.

1 major finding · 13 minor findings · 1 suggestion

Findings

Link

[major] · Onboarding carries settings into a different data directory

Changing directories after editing onboarding options carries those edits into the newly selected profile, potentially enabling pruning or disabling its proxy, even though the user revisits the storage and connection steps before Start.

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

Details and suggested fix

Change storage or connection settings for directory A, then go Back, select an existing directory B, and finish onboarding. setDataDir() refreshes the preview without clearing touched settings, and applyPreviewValuesPreservingTouched() retains A's edited values instead of loading B's values. prepareApplyToArgs() associates them with B's newly resolved identity, so ValidatePendingApply() accepts them and finalization persists them. For example, toggling the proxy on and then off in A can erase B's saved proxy or override its configured proxy, allowing direct connections. A carried prune choice can instead enable pruning and require redownloading deleted history to restore archival storage. Command-line-restricted settings remain protected. The storage choice remains visible when revisiting that page, but the connection step does not automatically reopen the nested proxy settings.

Clear profile-specific touched state and reseed values from the new preview whenever the selected or resolved profile changes. Add regressions showing that edits made before switching do not overwrite B's prune or proxy configuration, while edits made after selecting B still apply.


Link

[minor] · Onboarding commits settings before acquiring the directory locks

Completing onboarding for a locked profile persists its selected settings before startup fails, extending pre-existing pre-lock writes to first-use QML onboarding.

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

Details and suggested fix

QmlGuiMain() calls FinalizeStartupSettings() before baseInitialize(). Finalization writes touched prune, proxy, listen and NAT-PMP settings plus qml_onboarded=true, but Core probes and acquires the data-directory and blocks-directory locks only during base initialization. If another node holds either lock, startup exits outside finalization's rollback scope. The running node can adopt those choices on restart or overwrite them on its next settings write, and the persisted marker normally skips subsequent onboarding. Core already rewrites settings.json before locking, and Widgets saved the Intro prune choice before locking when Intro appeared; neither prevents these additional QML changes. Keep staged values available in memory for parameter interaction, but persist onboarding changes only after AppInitLockDirectories() succeeds. A probe alone leaves a race. A locked-directory regression should distinguish onboarding changes from InitConfig()'s inherited rewrite.


Link

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

Most command-line, configuration, settings-finalization and directory-lock failures exit with only stderr/log reporting, leaving desktop-launch users without an explanation.

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

Details and suggested fix

QmlGuiMain() installs noui_connect(), whose message handler prints errors rather than displaying a dialog. Parse failures, unexpected tokens, ordinary InitConfig() failures, finalization failures and directory-lock errors can all return before createWindow() constructs RuntimeDialogModel. Unlike the Widgets entry point, these paths therefore provide no GUI explanation for an invalid -datadir, malformed bitcoin.conf, failed settings write or already-running node. The unreadable-settings path is an exception because ErrorSettingsRead() supplies its own Reset/Abort dialog; terminal launches also retain stderr output. Route the other pre-window errors through a plain-text QMessageBox or equivalent startup helper while retaining the InitError() log entry.


Link

[minor] · Deferred NAT-PMP changes can outlive the shutdown interrupt

Quitting during the 200 ms NAT-PMP deferral can start an uninterrupted mapping thread or race its shutdown, causing a hang or abort; this ordering defect was established statically, not reproduced.

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

Details and suggested fix

applyRuntimeCoreChange() schedules m_node.mapPort() with a context-bound QTimer::singleShot(), but nothing cancels it when shutdown starts. requestShutdown() first interrupts Core and then queues appShutdown() on the initialization worker, while OptionsQmlModel remains alive and the GUI event loop continues. If mapping was off, InterruptMapPort() does nothing; a delayed enable can then start a thread that StopMapPort() joins without interrupting, or start it after that shutdown step has passed. A delayed disable can also manipulate the same unsynchronized g_mapport_thread concurrently with the worker's stop operation. Cancel a member timer, or reject its callback, once shutdown has been requested.


Link

[minor] · Conflicting network flags escape startup error handling

bitcoin-qt -regtest -testnet reaches an unguarded GetChainTypeString() call, allowing std::runtime_error to 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 onboarding resolution or InitConfig(). Its GetChainArg() helper throws when more than one network selector is enabled, and neither QmlGuiMain() nor its caller catches that exception. The later guarded paths cannot handle an exception thrown before reaching them. This concerns conflicting command-line selectors, not conflicts read later from bitcoin.conf. Catch the exception around the early query and report it through InitError() with EXIT_FAILURE, preserving the chain-specific bootstrap settings setup. Add a regression for conflicting selectors.


Link

[minor] · Database cache input only accepts 4 to 8 MiB

The GUI uses the coins-DB component cap as the total -dbcache maximum, rejecting ordinary values including Core's defaults.

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

Details and suggested fix

m_max_dbcache_size_mib uses MAX_COINS_DB_CACHE >> 20, which is 8 MiB and limits only one share of kernel::CacheSizes. DeveloperOptions.qml enforces that maximum and tells users to choose between 4 and 8 MiB. The displayed 450 MiB or 1 GiB default therefore cannot be re-entered, and following the error message produces an unnecessarily small cache that slows validation and IBD. Use the Widgets input range, from MIN_DBCACHE_BYTES / 1_MiB to INT_MAX, rather than the component cap. Do not directly narrow the 64-bit MAX_DBCACHE_BYTES into the integer property.


Link

[minor] · Existing data directories require unnecessary parent write access

Onboarding rejects an otherwise usable existing data directory when its parent is not writable, and treats a saved GUI selection of that directory as unusable.

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

Details and suggested fix

ValidateCustomDataDir() checks that an existing target is a readable, traversable, writable directory, but then continues to require parent_info.isWritable(). A user-owned directory such as /mnt/data/bitcoin can be fully usable without permission to create entries in /mnt/data. selectCustomDataDir() refuses that choice, and startup resolution uses the same validator to reject a saved GUI directory. An explicit -datadir takes a different validation path and still works. Return success after validating an existing target; reserve the parent-creation check for a directory that does not yet exist.


Link

[minor] · QML migration removes the Widgets GUI's directory preference

For side-by-side Widgets use, removing strDataDir can redirect later launches to an existing default directory; QML reset also removes the Widgets display-unit preference.

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

Details and suggested fix

Completing onboarding with a GUI-owned directory selection requests GuiCleanup::DataDirAndReset. The migration opens Bitcoin/Bitcoin-Qt and removes strDataDir and fReset, rather than only copying the selection into the QML store. ClearLegacyGuiSettings() also removes DisplayBitcoinUnit during reset. Widgets Intro::showIfNeeded() still reads that store and, when the default directory exists and no chooser/reset option applies, uses it without prompting. A later bitcoin-qt-legacy or released Widgets launch can consequently omit the custom directory's wallets and start synchronization on the default disk. The legacy build is optional and off by default, and a one-way migration may be intentional. If side-by-side use is supported, copy these GUI preferences into the QML store without deleting the Widgets GUI keys.


Link

[minor] · Block-clock history loading can assert after the chain shrinks

An authenticated invalidateblock during startup history loading can make a cached-height lookup abort the GUI and node; this conditional failure was not reproduced.

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

Details and suggested fix

setTimeRatioListInitial() records the active height, then calls getBlockHash(height) separately for each height in the current 12-hour history. Each backend lookup acquires cs_main independently and returns Assert(ActiveChain()[height])->GetBlockHash(). An authenticated invalidateblock can disconnect blocks between those calls, leaving a later requested height above the active tip and triggering the assertion. The history loader runs after initialization reports success, when RPC can already serve requests. No unauthenticated trigger was identified. Capture a consistent history snapshot under one lock, or walk ancestors from a captured tip hash using lookups that can fail instead of asserting on mutable active-chain heights.


Link

[minor] · The QML GUI ignores -min

bitcoin-qt -min, including existing autostart entries using that flag, follows the normal-window startup path instead of starting minimized.

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

Details and suggested fix

SetupQmlGuiArgs() advertises -min as “Start minimized”, but production QML startup never reads it. MainWindow.qml unconditionally sets visible = true after restoring geometry, and createWindow() supplies no minimized-start policy. Widgets previously chose normal, minimized or tray-only visibility from the same flag, and its Windows autostart shortcut includes -min. Pass the startup visibility policy to the main window before its first exposure, and test the resulting window state rather than only successful argument parsing.


Link

[minor] · The installed bitcoin: handler rejects payment URIs

The Windows installer still routes bitcoin: links to bitcoin-qt.exe, but the QML executable rejects URI arguments and exits without a payment flow.

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

Details and suggested fix

share/setup.nsi.in registers the URL protocol command with the URI as %1. With BUILD_GUI, that command now starts the QML executable, whose argument handling rejects non-switch tokens instead of allowing the Widgets payment-URI exception. The QML frontend has no wallet payment flow, and the optional BUILD_GUI_LEGACY executable does not automatically become the handler. Until wallet support exists, stop registering this handler for the QML executable or provide an explicit explanatory response rather than leaving a broken association. This concerns payment-link handling, not signing or loss of funds.


Link

[minor] · Build guides describe the old BUILD_GUI dependencies and features

The guides still promise QR support with BUILD_GUI, and the Unix package lists omit the Qt Declarative dependencies now required by the QML executable.

Location: CMakeLists.txt:105 (head).

Details and suggested fix

BUILD_GUI now selects the QML application and requires Qml, Quick and QuickControls2; QR and DBus support instead depend on BUILD_GUI_LEGACY. However, doc/build-unix.md lists only the former Widgets Qt packages and describes -DBUILD_GUI=ON as enabling a QR-capable GUI. doc/build-osx.md repeats the old feature description. These instructions can leave Unix users without required CMake components or produce a different frontend than they expect. This mismatch was established from source, not an observed documentation-following build failure. Document both GUI options, their features, and the additional Qt Quick build/runtime packages.


Link

[minor] · Block-clock history retains disconnected blocks

Reorganizations and invalidations leave stale or duplicate timestamps in the block-clock model until a history rebuild or 12-hour reset; the visual result was not checked.

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

Details and suggested fix

ChainSyncModel forwards only block_time to setTimeRatioList(), which appends every timestamp inside the current 12-hour window without tracking height or hash. After a reorganization, the disconnected entries remain alongside replacement entries. An invalidation can append an ancestor's timestamp again. The list is rebuilt at initialization or cleared at the next boundary, but ordinary tip handling never reconciles it. Retain block identity and remove entries outside the new tip's ancestry before adding replacement history.


Link

[minor] · Automation preflight masks regtest profile errors

A regtest automation launch with a failed profile preview reports that -test-automation requires regtest, hiding the actual error and bypassing normal settings-read handling.

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

Details and suggested fix

The preflight condition rejects both !status.ok and a non-regtest resolved_chain with the same regtest-only message. ResolveOnboardingStartupStatus() can resolve regtest and then return an error while reading the profile, including settings_file_unreadable. Because preflight runs before that flag's fall-through branch, the launch exits without reaching InitConfig() and ErrorSettingsRead(). Separate the two cases: report status.error for an unsuccessful preview and reserve the regtest-only message for a successfully resolved non-regtest chain. The impact is confined to launches explicitly using -test-automation.


Optional improvements

Link

[suggestion] · Release GUI builds always include the automation bridge

The UI-driving bridge is compiled into every QML GUI build, while its argument assertions are excluded behind an undefined ENABLE_TEST_AUTOMATION macro.

Location: src/qml/CMakeLists.txt:159 (head).

Details and suggested fix

bitcoinqml unconditionally includes test/testbridge.cpp, independently of GUI test builds. The bridge remains appropriately restricted by explicit -test-automation opt-in, regtest checks, UserAccessOption and bounded commands, but release builds cannot omit this test-only interface. Meanwhile, test_guiargs.cpp guards its automation argument assertions with ENABLE_TEST_AUTOMATION, which no build file defines. Introduce a matching build option/definition that enables the bridge and assertions in test/CI application builds and excludes them from release builds. Keep a test-enabled production executable: the functional harness launches that executable with -test-automation, so moving the bridge only into unit-test runners would break the existing workflow.


Coverage details