mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
Merge bitcoin/bitcoin#32984: wallet: Set migrated wallet name only on success
060695c22atest: Failed load after migrate should restore backup (MarcoFalke)8a4cfddf23wallet: Set migrated wallet name only on success (Ava Chow) Pull request description: After a wallet is migrated and we are trying to load it, if it could not be loaded, don't try to set the wallet name. Otherwise we have a segfault. This can be tested by migrated a legacy wallet from another network (e.g. trying to migrate a testnet wallet on mainnet). The fixed behavior is return an error and restore the backup. ACKs for top commit: davidgumberg: ACK060695c22afurszy: ACK060695c22arkrux: ACK060695c22aw0xlt: reACK060695c22apablomartin4btc: ACK060695c22aTree-SHA512: f4289e0b3dedef0a3d734c18604f2fd0df0dc65e9641bc342cfa45088d2540a3f6631bbea8bdd394b2631fa83b38e8ac37c83cfc4b53b19dcbd0b820a9beb6e4
This commit is contained in:
@@ -4306,7 +4306,7 @@ util::Result<MigrationResult> MigrateLegacyToDescriptor(std::shared_ptr<CWallet>
|
||||
success = (wallet != nullptr);
|
||||
|
||||
// When no wallet is set, set the main wallet.
|
||||
if (!res.wallet) {
|
||||
if (success && !res.wallet) {
|
||||
res.wallet_name = wallet->GetName();
|
||||
res.wallet = std::move(wallet);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user