Files
ObsidianDragon/src/ui/windows/shield_dialog.h
T
DanSandClaude Opus 5.5 8b9a498eee perf(net): one balance scan per poll, filtered opstatus, a guarded merge scope
The Core poll ran z_gettotalbalance twice (minconf 0 and 1), each a whole-
wallet scan under dragonxd's cs_main. The spendable (minconf=1) call now
runs only after the display call succeeded, and only when something is
unconfirmed or pending or the exact total moved: about 95% of polls make
one scan instead of two. A forced post-send balance can no longer be lost
to a refused enqueue, and pending-send debits aren't re-applied each tick.

z_getoperationstatus is filtered to our opids with its real argument form
([[id,...]]; the old ["id"] was rejected), falling back to the unfiltered
call if a daemon refuses the filter. The Shield/Merge dialog's own polls
are filtered and session-guarded too, and finally reach Done; the dead
RPCClient wrappers are deleted.

The Merge/Consolidate scope scan becomes a tested state machine: one scan
at a time, failures latch behind a Retry button, only "node not ready"
retries by itself (10/30/60 s, at most 3), Lite never scans. Its 120 s
calls are maintenance calls: every main-thread disconnect aborts one in
flight first, so a lifecycle action no longer freezes the UI behind it.
An aborted merge that was already sent says it may still go through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:06:34 -05:00

65 lines
1.6 KiB
C++

// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
#pragma once
#include <string>
namespace dragonx {
class App;
namespace ui {
/**
* @brief Dialog for shielding coinbase rewards and merging funds
*/
class ShieldDialog {
public:
enum class Mode {
ShieldCoinbase, // Shield mining rewards (t-addr coinbase -> z-addr)
MergeToAddress // Merge multiple inputs to single z-addr
};
/**
* @brief Show the shield dialog
* @param mode Operating mode
*/
static void show(Mode mode = Mode::ShieldCoinbase);
/**
* @brief Show shield coinbase dialog for specific address
*/
static void showShieldCoinbase(const std::string& fromAddress = "*");
/**
* @brief Show merge to address dialog (generic — both transparent + shielded sources)
*/
static void showMerge();
/**
* @brief Show the consolidate-funds flow preset for wallet-bloat reduction (shielded notes).
* Used by the large-wallet nudges (Settings banner + alert action).
*/
static void showConsolidate();
/**
* @brief Render the dialog (call each frame)
*/
static void render(App* app);
/**
* @brief Close the dialog (used by the UI sweep teardown)
*/
static void hide();
/**
* @brief Forget the scope (inputs) read for the Merge/Consolidate view: the node connection changed,
* so it may be a different wallet. The next render reads it again once the node is ready.
*/
static void invalidateScope();
};
} // namespace ui
} // namespace dragonx