5#ifndef BITCOIN_TEST_FUZZ_UTIL_WALLET_H
6#define BITCOIN_TEST_FUZZ_UTIL_WALLET_H
34 wallet->m_keypool_size = 1;
40 const std::vector<std::string> DESCS{
47 for (
const std::string& desc_fmt : DESCS) {
48 for (
bool internal : {
true,
false}) {
53 auto parsed_desc = std::move(
Parse(descriptor, keys, error,
false).at(0));
56 assert(parsed_desc->IsRange());
57 assert(parsed_desc->IsSingleType());
62 auto& spk_manager =
Assert(
wallet->AddWalletDescriptor(w_desc, keys,
"", internal))->get();
63 wallet->AddActiveScriptPubKeyMan(spk_manager.GetID(), *
Assert(w_desc.descriptor->GetOutputType()), internal);
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, PayToAnchor, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
#define Assert(val)
Identity function.
Serialized script, used inside transaction inputs and outputs.
T PickValueInArray(const T(&array)[size])
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
virtual std::optional< int > getHeight()=0
Get current chain height, not including genesis block (returns 0 if chain only contains genesis block...
virtual uint256 getBlockHash(int height)=0
Get block hash. Height must be valid or this function will abort.
Descriptor with some wallet metadata.
static UniValue Parse(std::string_view raw)
Parse string to UniValue or throw runtime_error if string contains invalid JSON.
std::unique_ptr< WalletDatabase > CreateMockableWalletDatabase(MockableData records)
@ WALLET_FLAG_DESCRIPTORS
Indicate that this wallet supports DescriptorScriptPubKeyMan.
static constexpr auto OUTPUT_TYPES
std::map< CKeyID, CKey > keys
Wraps a descriptor wallet for fuzzing.
FuzzedWallet(interfaces::Chain &chain, const std::string &name, const std::string &seed_insecure)
void ImportDescriptors(const std::string &seed_insecure)
CScript GetScriptPubKey(FuzzedDataProvider &fuzzed_data_provider)
CTxDestination GetDestination(FuzzedDataProvider &fuzzed_data_provider)
std::shared_ptr< CWallet > wallet