feat(wallet): wallet-files list + switching (P2)
Second phase of multi-wallet: list wallet files and switch the active one. - Daemon plumbing: EmbeddedDaemon::setWalletFile -> start() passes -wallet=<name> (non-default only; skipped during the isolated seed-migration start), and DaemonController::syncSettings pushes active_wallet_file on each start. - App::switchToWallet: persist the new active wallet, then stop + restart the node on -wallet=<name> (rescan only if it was never synced in this datadir). Reuses the seed-adopt restart coordination; WalletState clears on disconnect and the P1 identity-scoped caches re-key, so no previous-wallet data leaks. Guarded: full-node, embedded daemon, not mid-restart, no pending send. - Wallets dialog (Settings -> Backup & Data -> "Wallets…"): a table of wallet files (datadir wallet*.dat + user-added folders' *.dat) with size (disk) and cached balance / address count / last-opened (wallet index), a current/Active badge, Open (switch), and Add folder. Out-of-datadir wallets show "import to open" (P3). Added as a sweep surface. - Mining payout safety: non-destructive warning if the pool-mode worker looks like a DragonX address not in the current wallet (stale after a switch). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -202,6 +202,9 @@ public:
|
||||
// per-wallet data (e.g. address-book contacts). Empty until addresses are known (pre-connect).
|
||||
std::string activeWalletIdentityHash() const;
|
||||
|
||||
data::WalletIndex& walletIndex() { return wallet_index_; }
|
||||
const data::WalletIndex& walletIndex() const { return wallet_index_; }
|
||||
|
||||
// Connection state (convenience wrappers)
|
||||
bool isConnected() const { return state_.connected; }
|
||||
int getBlockHeight() const { return state_.sync.blocks; }
|
||||
@@ -447,6 +450,10 @@ public:
|
||||
* Shows "Restarting daemon..." in the loading overlay while the daemon cycles.
|
||||
*/
|
||||
void restartDaemon();
|
||||
// Switch the active wallet: persist the new -wallet=<name>, stop the node, restart on it
|
||||
// (rescan only if it was never synced in this datadir). Per-wallet data follows automatically
|
||||
// via the identity-scoped caches (P1). No-op if that wallet is already active.
|
||||
void switchToWallet(const std::string& walletFile);
|
||||
|
||||
// Wallet encryption helpers
|
||||
void encryptWalletWithPassphrase(const std::string& passphrase);
|
||||
|
||||
Reference in New Issue
Block a user