6#include <chainparams.h>
26#include <validation.h>
65 if (!
desc_str.has_value())
return std::nullopt;
105 wallet.m_keypool_size = 1;
144 *std::get_if<PKHash>(&dest) :
205 if (options.sighash_type == 151) options.sighash_type = std::nullopt;
211 std::string descriptor;
227 wallet.m_keypool_size = 1;
236 std::vector<CKey>
keys;
239 if (!key.IsValid())
return;
241 if (!
pub_key.IsFullyValid())
return;
285 key = PickValue(fuzzed_data_provider, keys);
287 key = ConsumePrivateKey(fuzzed_data_provider, fuzzed_data_provider.ConsumeBool());
321 std::vector<CPubKey> pubkeys;
323 for (
size_t i = 1; i <
num_keys; i++) {
332 if (pubkeys.size() <
num_keys)
return;
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a scriptPubKey for the destination.
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination corresponds to one with an address.
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.
const TestingSetup * g_setup
An encapsulated private key.
bool IsValid() const
Check whether this private key is valid.
CPubKey GetPubKey() const
Compute the public key from a private key.
Serialized script, used inside transaction inputs and outputs.
A reference to a CScript: the Hash160 of its serialization.
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Cache for single descriptor's derived extended pubkeys.
Helper to initialize the global NodeClock, let a duration elapse, and reset it after use in a test.
std::string ConsumeRandomLengthString(size_t max_length)
T ConsumeIntegralInRange(T min, T max)
Converts a mocked descriptor string to a valid one.
void Init()
When initializing the target, populate the list of keys.
std::optional< std::string > GetDescriptor(std::string_view mocked_desc) const
Get an actual descriptor string from a descriptor string whose keys were mocked.
static constexpr int VERSION_HD_CHAIN_SPLIT
static constexpr int VERSION_HD_BASE
bool GetDescriptorString(std::string &out, bool priv) const
static UniValue Parse(std::string_view raw, ParamFormat format=ParamFormat::JSON)
Parse string to UniValue or throw runtime_error if string contains invalid JSON.
MockedDescriptorConverter MOCKED_DESC_CONVERTER
The converter of mocked descriptors, needs to be initialized when the target is.
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
wallet::DescriptorScriptPubKeyMan * CreateDescriptor(CWallet &keystore, const std::string &desc_str, const bool success)
std::unique_ptr< WalletDatabase > CreateMockableWalletDatabase()
@ WALLET_FLAG_DESCRIPTORS
Indicate that this wallet supports DescriptorScriptPubKeyMan.
constexpr TransactionSerParams TX_WITH_WITNESS
std::optional< PrecomputedTransactionData > PrecomputePSBTData(const PartiallySignedTransaction &psbt)
Compute a PrecomputedTransactionData object from a psbt.
constexpr int MAX_PUBKEYS_PER_MULTISIG
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Generate a multisig script.
constexpr auto MakeUCharSpan(const V &v) -> decltype(UCharSpanCast(std::span{v}))
Like the std::span constructor, but for (const) unsigned char member types only.
A mutable version of CTransaction.
Testing setup that configures a complete environment.
Instructions for how a PSBT should be signed or filled with information.
bool sign
Whether to sign or not.
std::vector< uint16_t > keys
SeedRandomStateForTest(SeedRand::ZEROS)
bool IsTooExpensive(std::span< const uint8_t > buffer)
Deriving "expensive" descriptors will consume useful fuzz compute. The compute is better spent on a s...
NodeSeconds ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
CScript ConsumeScript(FuzzedDataProvider &fuzzed_data_provider, const bool maybe_p2wsh) noexcept
CKey ConsumePrivateKey(FuzzedDataProvider &fuzzed_data_provider, std::optional< bool > compressed) noexcept
std::map< COutPoint, Coin > ConsumeCoins(FuzzedDataProvider &fuzzed_data_provider) noexcept
auto & PickValue(FuzzedDataProvider &fuzzed_data_provider, Collection &col)
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
uint160 ConsumeUInt160(FuzzedDataProvider &fuzzed_data_provider) noexcept
@ ZEROS
Seed with a compile time constant of zeros.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
FuzzedDataProvider & fuzzed_data_provider
is a home for public enum and struct type definitions that are used by internally by wallet code,...