14#include <validation.h>
27void initialize_setup()
33FUZZ_TARGET(wallet_create_transaction, .init = initialize_setup)
36 FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
37 FakeNodeClock clock{
ConsumeTime(fuzzed_data_provider)};
39 Chainstate& chainstate{node.chainman->ActiveChainstate()};
40 ArgsManager&
args = *node.args;
45 "tprv8ZgxMBicQKsPd1QwsGgzfu2pcPYbBosZhJknqreRHgsWx32nNEhMjGQX2cgFL8n6wz9xdDYwLcs78N4nsCo32cxEX8RBtwGsEGgybLiQJfk",
63 CMutableTransaction tx;
67 all_values += n_value;
69 tx.
vout[0].nValue = n_value;
71 LOCK(fuzzed_wallet.wallet->cs_wallet);
75 fuzzed_wallet.wallet->RefreshTXOsFromTx(
ret.first->second);
78 std::vector<CRecipient> recipients;
84 destination = fuzzed_wallet.GetDestination(fuzzed_data_provider);
89 destination = CNoDestination{script};
95 recipients.push_back({destination,
100 std::optional<unsigned int> change_pos;
102 (void)
CreateTransaction(*fuzzed_wallet.wallet, recipients, change_pos, coin_control);
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.
constexpr CAmount MAX_MONEY
No amount larger than this (in satoshi) is valid.
int64_t CAmount
Amount in satoshis (Can be negative).
constexpr CAmount COIN
The amount of satoshis in one BTC.
std::string ToString(const T &t)
Locale-independent version of std::to_string.
const TestingSetup * g_setup
void ForceSetArg(const std::string &strArg, const std::string &strValue) EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
uint256 GetBlockHash() const
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
int Height() const
Return the maximal height in the chain.
std::optional< unsigned int > m_confirm_target
Override the default confirmation target if set.
std::optional< OutputType > m_change_type
Override the default change type if set, ignored if destChange is set.
bool m_allow_other_inputs
bool fOverrideFeeRate
Override automatic min/max checks on fee, m_feerate must be set if true.
std::optional< CFeeRate > m_feerate
Override the wallet's fee rate if set.
bool m_include_unsafe_inputs
If false, only safe inputs will be used.
bool m_avoid_partial_spends
Avoid partial use of funds sent to a given address.
uint32_t m_version
Version.
CTxDestination destChange
Custom change destination, if not set an address is generated.
std::optional< uint32_t > m_locktime
Locktime.
CFeeRate()=default
Fee rate of 0 satoshis per 0 vB.
T ConsumeIntegralInRange(T min, T max)
T PickValueInArray(const T(&array)[size])
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
std::string ToString(const T &t)
Locale-independent version of std::to_string.
util::Result< CreatedTransactionResult > CreateTransaction(CWallet &wallet, const std::vector< CRecipient > &vecSend, std::optional< unsigned int > change_pos, const CCoinControl &coin_control, bool sign)
Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also cr...
FUZZ_TARGET(coin_grinder)
constexpr auto OUTPUT_TYPES
std::unique_ptr< T > MakeNoLogFileContext(const ChainType chain_type=ChainType::REGTEST, TestOpts opts={})
Make a test setup that has disk access to the debug.log file disabled.
std::vector< CTxOut > vout
Txid GetHash() const
Compute the hash of this CMutableTransaction.
std::unique_ptr< interfaces::Chain > chain
Wraps a descriptor wallet for fuzzing.
State of transaction confirmed in a block.
SeedRandomStateForTest(SeedRand::ZEROS)
NodeSeconds ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
CTxDestination ConsumeTxDestination(FuzzedDataProvider &fuzzed_data_provider) noexcept
CAmount ConsumeMoney(FuzzedDataProvider &fuzzed_data_provider, const std::optional< CAmount > &max) noexcept
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
@ ZEROS
Seed with a compile time constant of zeros.