Bitcoin Core  24.1.0
P2P Digital Currency
tx_out.cpp
Go to the documentation of this file.
1 // Copyright (c) 2019-2020 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <consensus/validation.h>
6 #include <core_memusage.h>
7 #include <policy/feerate.h>
8 #include <policy/policy.h>
10 #include <streams.h>
11 #include <test/fuzz/fuzz.h>
12 #include <version.h>
13 
14 FUZZ_TARGET(tx_out)
15 {
17  CTxOut tx_out;
18  try {
19  int version;
20  ds >> version;
21  ds.SetVersion(version);
22  ds >> tx_out;
23  } catch (const std::ios_base::failure&) {
24  return;
25  }
26 
27  const CFeeRate dust_relay_fee{DUST_RELAY_TX_FEE};
28  (void)GetDustThreshold(tx_out, dust_relay_fee);
29  (void)IsDust(tx_out, dust_relay_fee);
30  (void)RecursiveDynamicUsage(tx_out);
31 
32  (void)tx_out.ToString();
33  (void)tx_out.IsNull();
34  tx_out.SetNull();
35  assert(tx_out.IsNull());
36 }
void SetNull()
Definition: transaction.h:171
assert(!tx.IsCoinBase())
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:185
std::string ToString() const
Definition: transaction.cpp:60
bool IsNull() const
Definition: transaction.h:177
static const int INIT_PROTO_VERSION
initial proto version, to be increased after version/verack negotiation
Definition: version.h:15
An output of a transaction.
Definition: transaction.h:156
FUZZ_TARGET(tx_out)
Definition: tx_out.cpp:14
CAmount GetDustThreshold(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
Definition: policy.cpp:26
static constexpr unsigned int DUST_RELAY_TX_FEE
Min feerate for defining dust.
Definition: policy.h:55
Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.
Definition: feerate.h:32
static size_t RecursiveDynamicUsage(const CScript &script)
Definition: core_memusage.h:12
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
Definition: policy.cpp:65
void SetVersion(int n)
Definition: streams.h:277