mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-26 23:09:03 +02:00
interfaces, wallet: Expose migrate wallet
This commit is contained in:
@@ -42,6 +42,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;
|
||||
@@ -631,6 +632,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