mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-20 12:29:22 +00:00
wallet: improve post-migration logging
Right now, after migration the last message users see is "migration completed", but the migration isn't actually finished yet. We still need to load the new wallets to ensure consistency, and if that fails, the migration will be rolled back. This can be confusing for users. This change logs the post-migration loading step and if a wallet fails to load and the migration will be rolled back. Github-Pull: bitcoin/bitcoin#34156 Rebased-From: d70b159c42008ac3b63d1c43d99d4f1316d2f1ef
This commit is contained in:
parent
75b59e5aba
commit
fb4406e63a
@ -4463,7 +4463,12 @@ util::Result<MigrationResult> MigrateLegacyToDescriptor(const std::string& walle
|
||||
std::string name = to_reload->GetName();
|
||||
to_reload.reset();
|
||||
to_reload = LoadWallet(context, name, /*load_on_start=*/std::nullopt, options, status, error, warnings);
|
||||
return to_reload != nullptr;
|
||||
if (!to_reload) {
|
||||
LogError("Failed to load wallet '%s' after migration. Rolling back migration to preserve consistency. "
|
||||
"Error cause: %s\n", wallet_name, error.original);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
// Before anything else, check if there is something to migrate.
|
||||
@ -4544,6 +4549,7 @@ util::Result<MigrationResult> MigrateLegacyToDescriptor(const std::string& walle
|
||||
if (success) {
|
||||
// Migration successful, unload all wallets locally, then reload them.
|
||||
// Reload the main wallet
|
||||
LogInfo("Loading new wallets after migration...\n");
|
||||
track_for_cleanup(*local_wallet);
|
||||
success = reload_wallet(local_wallet);
|
||||
res.wallet = local_wallet;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user