ScriptPubKeyMan
migration. It creates a LegacyDataSPKM
which can have some keys/scripts/etc, and then migrate it to descriptor. I tried to keep it as compatible as possible with future legacy wallet removal.
ScriptPubKeyMan
migration. It creates a LegacyDataSPKM
which can have some keys/scripts/etc, and then migrate it to descriptor. I tried to keep it as compatible as possible with future legacy wallet removal.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/29694.
See the guideline for information on the review process. A summary of reviews will appear here.
223+ keys.push_back(key);
224+ }
225+
226+ if (keys.empty()) return;
227+
228+ auto& legacy_spkm{*wallet.GetOrCreateLegacyScriptPubKeyMan()};
LegacyDataSPKM
. This will let you avoid crafting the bdb file manually when bdb is not compiled anymore.
You might need to add a mechanism to mock the bdb reader class just so you can feed the migration process with a hand-crafted LegacyDataSPKM. This will let you avoid crafting the bdb file manually when bdb is not compiled anymore.
You’re right, I’ll move this PR to draft to work on it.
LegacyDataSPKM
. Note that this target is about the spkm migration only, not the whole process.
243+ if (legacy_data.HaveKey(keys[key_index].GetPubKey().GetID())) return;
244+ if (legacy_data.LoadKey(keys[key_index], keys[key_index].GetPubKey())) {
245+ load_key_count++;
246+ if (fuzzed_data_provider.ConsumeBool()) {
247+ CHDChain hd_chain;
248+ hd_chain.nVersion = CHDChain::VERSION_HD_CHAIN_SPLIT;
284+ }
285+
286+ std::optional<MigrationData> res{legacy_data.MigrateToDescriptor()};
287+ if (res.has_value()) {
288+ assert(static_cast<int>(res->desc_spkms.size()) >= load_key_count);
289+ if (!res->solvable_descs.empty()) assert(script_count > 0);
script_count
to really be watchonly script count and just have it increment only when a watchonly script is added?
wallet/scriptpubkey.cpp
which I don’t think would be a valuable approach here.
283+ );
284+ }
285+
286+ std::optional<MigrationData> res{legacy_data.MigrateToDescriptor()};
287+ if (res.has_value()) {
288+ assert(static_cast<int>(res->desc_spkms.size()) >= load_key_count);
desc_spkms
should be load_key_count
plus the number of spendable scripts.
263+ },
264+ [&] {
265+ CScript script{ConsumeScript(fuzzed_data_provider)};
266+ const auto key_index{fuzzed_data_provider.ConsumeIntegralInRange<int>(0, keys.size() - 1)};
267+ LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 2) {
268+ CallOneOf(
Force-pushed addressing (multisig and hd chain cover):