0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-09 10:43:19 -05:00

fuzz: add more coverage for ScriptPubKeyMan

This commit is contained in:
brunoerg 2024-05-08 08:35:00 -03:00
parent b94061902e
commit e3249f2111

View file

@ -137,6 +137,15 @@ FUZZ_TARGET(scriptpubkeyman, .init = initialize_spkm)
PKHash{ConsumeUInt160(fuzzed_data_provider)}}; PKHash{ConsumeUInt160(fuzzed_data_provider)}};
std::string str_sig; std::string str_sig;
(void)spk_manager->SignMessage(msg, pk_hash, str_sig); (void)spk_manager->SignMessage(msg, pk_hash, str_sig);
(void)spk_manager->GetMetadata(dest);
}
}
},
[&] {
auto spks{spk_manager->GetScriptPubKeys()};
for (const CScript& spk : spks) {
if (fuzzed_data_provider.ConsumeBool()) {
spk_manager->MarkUnusedAddresses(spk);
} }
} }
}, },
@ -148,6 +157,10 @@ FUZZ_TARGET(scriptpubkeyman, .init = initialize_spkm)
} }
spk_manager->AddDescriptorKey(key, key.GetPubKey()); spk_manager->AddDescriptorKey(key, key.GetPubKey());
spk_manager->TopUp(); spk_manager->TopUp();
LOCK(spk_manager->cs_desc_man);
auto particular_key{spk_manager->GetKey(key.GetPubKey().GetID())};
assert(*particular_key == key);
assert(spk_manager->HasPrivKey(key.GetPubKey().GetID()));
}, },
[&] { [&] {
std::string descriptor; std::string descriptor;
@ -194,6 +207,9 @@ FUZZ_TARGET(scriptpubkeyman, .init = initialize_spkm)
} }
); );
} }
(void)spk_manager->GetEndRange();
(void)spk_manager->GetKeyPoolSize();
} }
} // namespace } // namespace