feat(wallet): enable auto-consolidation by default
Default the auto_consolidate setting to true, so a full-node wallet keeps its note count down on its own out of the box (users can still turn it off). A missing key in an older config loads the new default, enabling it on upgrade, which is intended. The page-state mirror default matches. Safety is unchanged and reinforced in comments: auto-consolidation reuses the "keep in each address" engine — z_mergetoaddress [addr] -> addr — so funds NEVER move between addresses; it only sheds notes within each address. It never uses the "into one address" sweep. It also only runs when the wallet is idle AND unlocked (a locked encrypted wallet never auto-runs) and only touches addresses with more than kAutoConsolidateMinNotes notes, so a fresh or lean wallet stays dormant. Build + tests + hygiene green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -6374,6 +6374,9 @@ void App::finishConsolidation()
|
|||||||
|
|
||||||
// Start the shared ConsolidationRun with the SAME guards as startConsolidation but SILENTLY and with a
|
// Start the shared ConsolidationRun with the SAME guards as startConsolidation but SILENTLY and with a
|
||||||
// caller-chosen (gentle) config — the background driver's entry point. No toasts; marks the run as ours.
|
// caller-chosen (gentle) config — the background driver's entry point. No toasts; marks the run as ours.
|
||||||
|
// Like the manual "keep in each address" mode, this run merges every address's notes back into THAT SAME
|
||||||
|
// address (z_mergetoaddress [addr] -> addr in postConsolidationCall), so auto-consolidation NEVER moves
|
||||||
|
// funds between addresses — it only sheds notes. It never uses the "into one address" sweep.
|
||||||
bool App::startConsolidationQuiet(const std::vector<services::NoteGroup>& groups, services::RunConfig cfg)
|
bool App::startConsolidationQuiet(const std::vector<services::NoteGroup>& groups, services::RunConfig cfg)
|
||||||
{
|
{
|
||||||
if (isLiteBuild() || capture_mode_ || shutting_down_.load()) return false;
|
if (isLiteBuild() || capture_mode_ || shutting_down_.load()) return false;
|
||||||
|
|||||||
@@ -230,7 +230,9 @@ public:
|
|||||||
bool getAutoShield() const { return auto_shield_; }
|
bool getAutoShield() const { return auto_shield_; }
|
||||||
void setAutoShield(bool shield) { auto_shield_ = shield; }
|
void setAutoShield(bool shield) { auto_shield_ = shield; }
|
||||||
// Automatic background note consolidation (full-node): when on, the wallet quietly merges small notes
|
// Automatic background note consolidation (full-node): when on, the wallet quietly merges small notes
|
||||||
// in tiny batches while idle (see App::pumpAutoConsolidation). Off by default.
|
// in tiny batches while idle (see App::pumpAutoConsolidation). Each address's notes are merged back into
|
||||||
|
// THAT SAME address (z_mergetoaddress [addr] -> addr), so funds never move between addresses. On by
|
||||||
|
// default — a missing key in an older config therefore enables it on upgrade, which is intended.
|
||||||
bool getAutoConsolidate() const { return auto_consolidate_; }
|
bool getAutoConsolidate() const { return auto_consolidate_; }
|
||||||
void setAutoConsolidate(bool v) { auto_consolidate_ = v; }
|
void setAutoConsolidate(bool v) { auto_consolidate_ = v; }
|
||||||
|
|
||||||
@@ -731,7 +733,7 @@ private:
|
|||||||
int time_format_ = 0; // global clock: 0 = 24h, 1 = 12h
|
int time_format_ = 0; // global clock: 0 = 24h, 1 = 12h
|
||||||
bool save_ztxs_ = true;
|
bool save_ztxs_ = true;
|
||||||
bool auto_shield_ = true;
|
bool auto_shield_ = true;
|
||||||
bool auto_consolidate_ = false;
|
bool auto_consolidate_ = true;
|
||||||
bool use_tor_ = false;
|
bool use_tor_ = false;
|
||||||
bool allow_custom_fees_ = false;
|
bool allow_custom_fees_ = false;
|
||||||
double default_fee_ = 0.0001;
|
double default_fee_ = 0.0001;
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ struct SettingsPageState {
|
|||||||
bool save_ztxs = true;
|
bool save_ztxs = true;
|
||||||
bool allow_custom_fees = false;
|
bool allow_custom_fees = false;
|
||||||
bool auto_shield = false;
|
bool auto_shield = false;
|
||||||
bool auto_consolidate = false;
|
bool auto_consolidate = true; // on by default (loaded from settings on open; see getAutoConsolidate)
|
||||||
bool fetch_prices = true;
|
bool fetch_prices = true;
|
||||||
bool use_tor = false;
|
bool use_tor = false;
|
||||||
char rpc_host[128] = DRAGONX_DEFAULT_RPC_HOST;
|
char rpc_host[128] = DRAGONX_DEFAULT_RPC_HOST;
|
||||||
|
|||||||
Reference in New Issue
Block a user