feat(recovery): import keys from a legacy wallet backup file (z_importwallet)
Phase 3: for a wallet.dat the current daemon can't open, recover its keys from the OLD wallet's export file. Settings → "Import From Backup File…" opens a dialog that takes the path to a z_exportwallet / dumpwallet dump (or SilentDragon's "Export all private keys") and calls z_importwallet — the daemon reads every key and does ONE rescan, far faster and simpler than importing keys one at a time. On success it nudges the user to shield any mined coinbase from the Shield screen. - New App::importWalletFile(path, cb): runs z_importwallet on the long-call lane (no client timeout — the rescan can take a long time), then refreshAddresses + markWalletMutated. Full-node only. - Only the PATH touches GUI memory, never the keys themselves (the daemon reads the file) — less secret exposure than a pasted-key field. - New renderImportWalletFileDialog (typed path + Paste/Clear, progress, result) + a Settings card. Reuses the existing long-call + z_importwallet infra; the careful single-key import dialog is untouched. No send/sweep/encrypt call changed. Build + ctest green; the import/rescan itself is a daemon RPC, not pure-testable, and wasn't exercised end-to-end here. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -650,6 +650,9 @@ public:
|
||||
// Dialog triggers (used by settings page to open modal dialogs)
|
||||
void showImportKeyDialog() { import_view_mode_ = false; show_import_key_ = true; } // spending
|
||||
void showImportViewingKeyDialog() { import_view_mode_ = true; show_import_key_ = true; } // watch-only
|
||||
void showImportWalletFileDialog() { show_import_wallet_file_ = true; } // import a whole legacy key dump
|
||||
// Import every key from an old wallet's z_exportwallet/dumpwallet dump file (z_importwallet, one rescan).
|
||||
void importWalletFile(const std::string& path, std::function<void(bool, const std::string&)> callback);
|
||||
void showExportKeyDialog() { show_export_key_ = true; }
|
||||
void showBackupDialog() { show_backup_ = true; }
|
||||
void showSeedBackupDialog() { show_seed_backup_ = true; }
|
||||
@@ -1419,6 +1422,12 @@ private:
|
||||
bool show_about_ = false;
|
||||
bool show_faq_ = false;
|
||||
bool show_import_key_ = false;
|
||||
bool show_import_wallet_file_ = false; // the "import keys from a backup file" modal is open
|
||||
char import_wallet_file_path_[1024] = {0}; // typed path to the old wallet's key dump (not a secret)
|
||||
bool import_wallet_file_busy_ = false; // a z_importwallet long call is in flight
|
||||
bool import_wallet_file_done_ = false; // terminal result reached (ok/err in import_wallet_file_ok_)
|
||||
bool import_wallet_file_ok_ = false;
|
||||
std::string import_wallet_file_status_; // result / error text shown in the modal
|
||||
bool show_export_key_ = false;
|
||||
bool show_backup_ = false;
|
||||
bool show_seed_backup_ = false;
|
||||
@@ -2060,6 +2069,7 @@ private:
|
||||
void renderLiteFirstRunPrompt(); // lite-only welcome modal when no wallet exists yet
|
||||
void renderLiteUnlockPrompt(); // lite-only send-time unlock modal
|
||||
void renderImportKeyDialog();
|
||||
void renderImportWalletFileDialog(); // typed-path import of a legacy key dump (z_importwallet)
|
||||
void renderExportKeyDialog();
|
||||
void renderBackupDialog();
|
||||
void renderSeedBackupDialog(); // full-node "Back up seed phrase" modal (z_exportmnemonic)
|
||||
|
||||
Reference in New Issue
Block a user