feat(settings): rescan-height guards, auto-consolidate status + opt-in default (F061/F070)

UX audit, Settings surface (batch 3):

- F061: the runtime rescan-from-height dialog shows the current chain height, flags a
  value above it (and disables Rescan with that as the inline reason), and adds
  "Last 1,000 / 10,000" presets — previously a bare InputInt clamped only at 0.
- F070: "Auto-consolidate notes" gains a live status line (Idle / Merging — batch X of Y
  / Paused until synced) and is now OFF by default, matching the documented intent for a
  background fund-moving feature (it no longer silently defaults on). Choice a.

New strings (English). Build + tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 14:41:50 -06:00
co-authored by Claude Opus 4.8
parent 3c5f3b9d69
commit 0f5627f151
3 changed files with 48 additions and 3 deletions
+1 -1
View File
@@ -735,7 +735,7 @@ private:
int time_format_ = 0; // global clock: 0 = 24h, 1 = 12h
bool save_ztxs_ = true;
bool auto_shield_ = true;
bool auto_consolidate_ = true;
bool auto_consolidate_ = false; // opt-in: a background fund-moving behaviour shouldn't default on (F070)
bool use_tor_ = false;
bool allow_custom_fees_ = false;
double default_fee_ = 0.0001;
+40 -2
View File
@@ -93,7 +93,7 @@ struct SettingsPageState {
bool save_ztxs = true;
bool allow_custom_fees = false;
bool auto_shield = false;
bool auto_consolidate = true; // on by default (loaded from settings on open; see getAutoConsolidate)
bool auto_consolidate = false; // opt-in (loaded from settings on open; see getAutoConsolidate) (F070)
bool fetch_prices = true;
bool use_tor = false;
char rpc_host[128] = DRAGONX_DEFAULT_RPC_HOST;
@@ -1351,6 +1351,24 @@ void RenderSettingsPage(App* app) {
if (CB(TrId("auto_consolidate", "auto_consol"), &s_settingsState.auto_consolidate))
saveSettingsPageState(app->settings());
if (ImGui::IsItemHovered()) material::Tooltip("%s", TR("tt_auto_consolidate"));
// F070: surface this background fund-moving behaviour with a live status under the checkbox.
if (s_settingsState.auto_consolidate) {
const auto& crun = app->consolidation();
char consStatus[96];
if (crun.active()) {
const auto pr = crun.progress();
if (pr.wait == services::RunWait::Syncing)
snprintf(consStatus, sizeof(consStatus), "%s", TR("auto_consol_status_syncing"));
else
snprintf(consStatus, sizeof(consStatus), TR("auto_consol_status_merging"),
pr.batchesDone, pr.batchesEstimated);
} else {
snprintf(consStatus, sizeof(consStatus), "%s", TR("auto_consol_status_idle"));
}
ImGui::Indent();
ImGui::TextDisabled("%s", consStatus);
ImGui::Unindent();
}
// (Stratum pool hosting lives in the Node & Security tab — it's a node feature.)
}
if (CB(TrId("verbose_logging", "verbose"), &s_settingsState.verbose_logging)) {
@@ -3504,16 +3522,34 @@ void RenderSettingsPage(App* app) {
const bool detecting = s_settingsState.rescan_height_detecting;
const bool bootstrapped = s_settingsState.rescan_height_detected && !s_settingsState.rescan_full_history;
const int tipH = (int)app->state().sync.blocks; // current chain height (F061)
if (detecting) {
ImGui::TextWrapped("%s", TR("rescan_detecting"));
} else if (bootstrapped) {
ImGui::TextWrapped("%s", TR("rescan_bootstrapped_msg"));
ImGui::Spacing();
if (tipH > 0) ImGui::TextDisabled(TR("rescan_current_height"), tipH); // F061
ImGui::Text("%s", TR("rescan_from_height"));
ImGui::SetNextItemWidth(160.0f * dp);
ImGui::InputInt("##rescanHeight", &s_settingsState.rescan_start_height);
if (s_settingsState.rescan_start_height < 0) s_settingsState.rescan_start_height = 0;
// Quick presets (F061).
if (tipH > 1000) {
if (material::TactileButton(TrId("rescan_preset_1k", "rp1k").c_str(), ImVec2(0, 0), S.resolveFont("button")))
s_settingsState.rescan_start_height = tipH - 1000;
if (tipH > 10000) {
ImGui::SameLine();
if (material::TactileButton(TrId("rescan_preset_10k", "rp10k").c_str(), ImVec2(0, 0), S.resolveFont("button")))
s_settingsState.rescan_start_height = tipH - 10000;
}
}
// Flag an out-of-range height; the Rescan button is disabled below while invalid. (F061)
if (tipH > 0 && s_settingsState.rescan_start_height > tipH) {
ImGui::PushStyleColor(ImGuiCol_Text, material::WarningVec4());
ImGui::TextWrapped(TR("rescan_height_too_high"), tipH);
ImGui::PopStyleColor();
}
} else {
if (s_settingsState.rescan_probe_failed) {
// A long line: TextColored does not wrap, so colour a wrapped one.
@@ -3536,7 +3572,9 @@ void RenderSettingsPage(App* app) {
s_settingsState.confirm_rescan = false;
}
ImGui::SameLine();
ImGui::BeginDisabled(detecting);
// Block a from-height above the tip (F061).
const bool rescanHeightInvalid = bootstrapped && tipH > 0 && s_settingsState.rescan_start_height > tipH;
ImGui::BeginDisabled(detecting || rescanHeightInvalid);
if (material::TactileButton(TrId("rescan", "rescan_confirm").c_str(), ImVec2(btnW, 40 * dp))) {
if (bootstrapped) {
app->runtimeRescan(s_settingsState.rescan_start_height);
+7
View File
@@ -955,6 +955,9 @@ void I18n::loadBuiltinEnglish()
strings_["tt_save_ztx"] = "Store z-address transaction history locally for faster loading";
strings_["tt_auto_shield"] = "Automatically move transparent balance to shielded addresses for privacy";
strings_["tt_auto_consolidate"] = "Quietly merge small notes in the background while the wallet is idle, in tiny batches. Slower than a manual consolidation but barely noticeable, and each address's funds stay separate. Good for mining/pool wallets that accumulate thousands of notes.";
strings_["auto_consol_status_idle"] = "Idle";
strings_["auto_consol_status_merging"] = "Merging notes \xE2\x80\x94 batch %d of %d";
strings_["auto_consol_status_syncing"] = "Paused until the wallet is synced";
strings_["tt_tor"] = "Route daemon connections through the Tor network for anonymity";
strings_["tt_tor_unavailable"] = "Not available yet: this wallet does not route any traffic through Tor. For the node only, you can add proxy=127.0.0.1:9050 to DRAGONX.conf and restart the node. Tor must be running, or the node finds no peers. Price, update, bootstrap and pool requests still connect directly; use a system-wide VPN/Tor for those.";
strings_["tt_tor_unavailable_lite"] = "Not available yet: this wallet does not route any traffic through Tor. Use a system-wide VPN/Tor.";
@@ -1064,6 +1067,10 @@ void I18n::loadBuiltinEnglish()
strings_["rescan_probe_failed"] = "Couldn't check which blocks your node has on disk (it is busy or a request timed out). If this node was restored from a bootstrap, cancel and try again in a minute: the full -rescan restart below fails on a bootstrapped node.";
strings_["rescan_bootstrapped_msg"] = "Your node was bootstrapped, so blocks below the snapshot aren't on disk and a rescan from genesis would fail. Rescan from a height your snapshot includes to reconcile your wallet's spent balance. Your wallet.dat and chain data are not deleted.";
strings_["rescan_from_height"] = "Rescan from block height:";
strings_["rescan_current_height"] = "Current height: %d";
strings_["rescan_height_too_high"] = "Above the current chain height (%d) — choose a lower block.";
strings_["rescan_preset_1k"] = "Last 1,000";
strings_["rescan_preset_10k"] = "Last 10,000";
strings_["repair_wallet"] = "Repair";
strings_["tt_repair_wallet"] = "Wipe and rebuild the wallet's transaction records from the blockchain (fixes notes that fail to send after a rescan)";
strings_["confirm_repair_wallet_title"] = "Repair Wallet";