mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 23:03:45 +01:00
Merge bitcoin-core/gui#738: Add menu option to migrate a wallet
48aae2cffegui: Add File > Migrate Wallet (Andrew Chow)577be889cdgui: Optionally return passphrase after unlocking (Andrew Chow)5b3a85b4c6interfaces, wallet: Expose migrate wallet (Andrew Chow) Pull request description: GUI users need to be able to migrate wallets without going to the RPC console. ACKs for top commit: jarolrod: ACK48aae2cffepablomartin4btc: tACK48aae2cffehebasto: ACK48aae2cffeTree-SHA512: 2d02b1e85e7d6cfbf503f417f150cdaa0c63822942e9a6fe28c0ad3e7f40a957bb01a375c909a60432dc600e84574881aa446c7ec983b56f0bb23f07ef15de54
This commit is contained in:
@@ -41,6 +41,7 @@ using interfaces::Wallet;
|
||||
using interfaces::WalletAddress;
|
||||
using interfaces::WalletBalances;
|
||||
using interfaces::WalletLoader;
|
||||
using interfaces::WalletMigrationResult;
|
||||
using interfaces::WalletOrderForm;
|
||||
using interfaces::WalletTx;
|
||||
using interfaces::WalletTxOut;
|
||||
@@ -630,6 +631,18 @@ public:
|
||||
return util::Error{error};
|
||||
}
|
||||
}
|
||||
util::Result<WalletMigrationResult> migrateWallet(const std::string& name, const SecureString& passphrase) override
|
||||
{
|
||||
auto res = wallet::MigrateLegacyToDescriptor(name, passphrase, m_context);
|
||||
if (!res) return util::Error{util::ErrorString(res)};
|
||||
WalletMigrationResult out{
|
||||
.wallet = MakeWallet(m_context, res->wallet),
|
||||
.watchonly_wallet_name = res->watchonly_wallet ? std::make_optional(res->watchonly_wallet->GetName()) : std::nullopt,
|
||||
.solvables_wallet_name = res->solvables_wallet ? std::make_optional(res->solvables_wallet->GetName()) : std::nullopt,
|
||||
.backup_path = res->backup_path,
|
||||
};
|
||||
return {std::move(out)}; // std::move to work around clang bug
|
||||
}
|
||||
std::string getWalletDir() override
|
||||
{
|
||||
return fs::PathToString(GetWalletDir());
|
||||
|
||||
Reference in New Issue
Block a user