39 std::vector<COutPoint> outpoints;
41 for (uint8_t i = 0; i < 4; i++) {
45 const bool duplicate_input = fuzzed_data_provider.
ConsumeBool();
55 for (uint32_t i = 0; i < num_in; i++) {
56 auto& prevout =
PickValue(fuzzed_data_provider, outpoints);
57 tx_mut.
vin.emplace_back(prevout);
59 if (!duplicate_input) {
60 std::swap(prevout, outpoints.back());
65 for (uint32_t i = 0; i < num_out; i++) {
69 for (
auto& in : tx_mut.
vin) {
70 outpoints.push_back(in.prevout);
74 for (uint32_t i = 0; i < num_out; i++) {
75 outpoints.emplace_back(new_tx->GetHash(), i);
104 bool add_tx = orphanage.AddTx(tx, peer_id);
106 Assert(!have_tx || !add_tx);
110 bool add_tx = orphanage.AddTx(tx, peer_id);
112 Assert(!have_tx == (GetTransactionWeight(*tx) > MAX_STANDARD_TX_WEIGHT));
113 Assert(!have_tx || !add_tx);
120 Assert(have_tx == orphanage.EraseTx(tx->GetHash()));
125 Assert(!have_tx && !orphanage.EraseTx(tx->GetHash()));
int64_t CAmount
Amount in satoshis (Can be negative)
#define Assert(val)
Identity function.
Serialized script, used inside transaction inputs and outputs.
T ConsumeIntegralInRange(T min, T max)
static GenTxid Wtxid(const uint256 &hash)
static GenTxid Txid(const uint256 &hash)
A class to track orphan transactions (failed on TX_MISSING_INPUTS) Since we cannot distinguish orphan...
void AddChildrenToWorkSet(const CTransaction &tx) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Add any orphans that list a particular tx as a parent into the from peer's work set.
bool HaveTx(const GenTxid >xid) const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Check if we already have an orphan transaction (by txid or wtxid)
size_t Size() EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Return how many entries exist in the orphange.
CTransactionRef GetTxToReconsider(NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Extract a transaction from a peer's work set Returns nullptr if there are no transactions to work on.
void EraseForPeer(NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Erase all orphans announced by a peer (eg, after that peer disconnects)
void LimitOrphans(unsigned int max_orphans) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Limit the orphanage to the given maximum.
static transaction_identifier FromUint256(const uint256 &id)
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
static const uint32_t DEFAULT_MAX_ORPHAN_TRANSACTIONS
Default for -maxorphantx, maximum number of orphan transactions kept in memory.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
std::shared_ptr< const CTransaction > CTransactionRef
std::unique_ptr< T > MakeNoLogFileContext(const ChainType chain_type=ChainType::REGTEST, const std::vector< const char * > &extra_args={})
Make a test setup that has disk access to the debug.log file disabled.
A mutable version of CTransaction.
std::vector< CTxOut > vout
int64_t ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
auto & PickValue(FuzzedDataProvider &fuzzed_data_provider, Collection &col)
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
void initialize_orphanage()
FUZZ_TARGET(txorphan,.init=initialize_orphanage)