MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / GetDescriptorsForLegacy

Method GetDescriptorsForLegacy

src/wallet/wallet.cpp:3920–3937  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3918}
3919
3920std::optional<MigrationData> CWallet::GetDescriptorsForLegacy(bilingual_str& error) const
3921{
3922 AssertLockHeld(cs_wallet);
3923
3924 LegacyDataSPKM* legacy_spkm = GetLegacyDataSPKM();
3925 if (!Assume(legacy_spkm)) {
3926 // This shouldn't happen
3927 error = Untranslated(STR_INTERNAL_BUG("Error: Legacy wallet data missing"));
3928 return std::nullopt;
3929 }
3930
3931 std::optional<MigrationData> res = legacy_spkm->MigrateToDescriptor();
3932 if (res == std::nullopt) {
3933 error = _("Error: Unable to produce descriptors for this legacy wallet. Make sure to provide the wallet's passphrase if it is encrypted.");
3934 return std::nullopt;
3935 }
3936 return res;
3937}
3938
3939util::Result<void> CWallet::ApplyMigrationData(WalletBatch& local_wallet_batch, MigrationData& data)
3940{

Callers 1

wallet.cppFile · 0.80

Calls 3

UntranslatedFunction · 0.85
_Function · 0.85
MigrateToDescriptorMethod · 0.80

Tested by

no test coverage detected