Review report

bitcoin-core/gui-qml: PR #883

3 minor findings · 2 suggestions

Findings

Link

[minor] · Onboarding drops an explicit NAT-PMP opt-out when listening is disabled

On a fresh profile, disabling NAT-PMP together with listening or enabling a proxy loses the explicit NAT-PMP preference, allowing default-enabled port mapping to return after the disabling condition is removed.

Location: qml/onboarding_settings.cpp:731 (head).

Details and suggested fix

ApplyPendingCoreSettings writes proxy and listen changes, recomputes parameter interactions, and only then writes the touched NAT-PMP value. With no existing NAT-PMP setting, Core soft-sets natpmp=false when listening is off or a proxy is enabled. GuiOverrideValue treats the user's explicit false value as redundant with that forced value, so SetRwSetting erases it. Base computed interactions before the touched writes and saved this fresh-profile choice. The new preservation block handles listen but not NAT-PMP. Later enabling listening or removing the proxy can therefore restore default-enabled port mapping after restart on a supporting router. Preserve a touched NAT-PMP value when it matches an interaction-forced value, and add a regression that disables both switches, reloads settings, enables only listening, and verifies that NAT-PMP remains off.


Link

[minor] · An unwritable config-selected data directory no longer opens the chooser

A readable, onboarded profile selected by bitcoin.conf can skip the chooser despite an unwritable data directory, causing startup to fail instead of offering a replacement location.

Location: qml/onboarding_settings.cpp:1011 (head).

Details and suggested fix

With no explicit -datadir, a non-default datadir= directory that is readable and searchable can pass ReadResolvedProfile, including a readable settings.json containing qml_onboarded=true. The successful-read path checks isDir() but never calls ValidateCustomDataDir on the resolved directory. Base performed that validation before skipping onboarding. In the default mainnet settings layout, InitConfig then fails writing settings.json; restarts repeat the failure until permissions change or the user passes -choosedatadir. Validate resolved non-explicit, non-default directories on the successful-read path too, and cover a readable but write-protected onboarded profile. No report of an onboarded config-selected directory losing write permission was found, so production impact is unconfirmed.


Link

[minor] · The settings-recovery dialog ignores application Quit events

While the recovery dialog is open, QmlQuitHandler consumes application Quit events without dismissing the dialog, leaving startup waiting for a manual Reset or Abort.

Location: qml/bitcoin.cpp:375 (head).

Details and suggested fix

An unreadable settings.json without an effective automatic reset skips pre-init onboarding and opens ErrorSettingsRead through synchronous InitConfig. QmlQuitHandler consumes application QEvent::Quit events and emits quitRequested, but this new QMessageBox::exec() has neither a connection to that signal nor a pending-quit check. Unlike ExecStartupDialog, its nested loop therefore remains open after repeated delivered Quit events. If the user subsequently selects Reset, the synchronous path also continues preparation without checking the recorded quit request. Pass the quit handler into this function, return Abort when quit is already pending, and connect quitRequested to finish the box with the Abort result. Extend the native-quit bootstrap coverage to exercise this recovery dialog.


Optional improvements

Link

[suggestion] · Settings-file recovery also resets unrelated GUI preferences

Choosing Reset for an unreadable settings.json also clears active GUI preferences and legacy settings, although the prompt matches bitcoin-qt's narrower settings-file recovery.

Location: qml/onboarding_settings.cpp:1192 (head).

Details and suggested fix

The captured backup makes FinalizeStartupSettings treat recovery Reset like -resetguisettings. On the synchronous recovery path, this clears the active network's QSettings except strDataDir, sets fReset in the active and bootstrap stores, and removes legacy Core, display-unit, data-directory, and reset keys. Pinned bitcoin-qt's identical prompt only permits InitConfig to rewrite the unreadable settings.json; GUI reset is separate. Although guisettings.ini.bak preserves the active GUI preferences, corruption of Core's file need not require discarding language, theme, and display choices or cleaning legacy Bitcoin-Qt stores. Keep recovery limited to settings.json while retaining the byte-exact backup. If the full reset is intended, explicitly disclose its GUI and legacy-store scope in the prompt and PR description.


Link

[suggestion] · New-folder preview skips an explicit relative configuration file

An explicit relative -conf is skipped during new-folder preview but loaded after confirmation, potentially causing an inaccurate preview or a misleading profile-change rejection.

Location: qml/onboarding_settings.cpp:263 (head).

Details and suggested fix

ReadConfigForNewDataDir returns success for every non-absolute -conf. After apply creates the selected folder and sets -datadir, Core resolves an explicit path such as ../shared.conf against that folder and requires it to be readable. Configuration omitted from the preview can then select another chain, reset value, or settings path, causing ValidatePendingApply to reject the confirmed selection as profile drift; a missing file instead fails during configuration loading. Base also skipped this configuration, but lacked the new drift comparison. Resolve an explicit relative -conf and its relative includes against the proposed folder without creating it, while retaining normal behavior when no -conf was supplied. No current user passing a relative -conf with a newly selected folder was identified, so production impact is unconfirmed.


Coverage details