Bitcoin Core  22.99.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/policy.h>
9 #include <streams.h>
10 #include <test/fuzz/fuzz.h>
11 #include <version.h>
12 
13 FUZZ_TARGET(tx_out)
14 {
16  CTxOut tx_out;
17  try {
18  int version;
19  ds >> version;
20  ds.SetVersion(version);
21  ds >> tx_out;
22  } catch (const std::ios_base::failure&) {
23  return;
24  }
25 
26  const CFeeRate dust_relay_fee{DUST_RELAY_TX_FEE};
27  (void)GetDustThreshold(tx_out, dust_relay_fee);
28  (void)IsDust(tx_out, dust_relay_fee);
29  (void)RecursiveDynamicUsage(tx_out);
30 
31  (void)tx_out.ToString();
32  (void)tx_out.IsNull();
33  tx_out.SetNull();
34  assert(tx_out.IsNull());
35 }
policy.h
assert
assert(!tx.IsCoinBase())
streams.h
transaction.h
validation.h
version.h
CFeeRate
Fee rate in satoshis per kilobyte: CAmount / kB.
Definition: feerate.h:29
CTxOut::IsNull
bool IsNull() const
Definition: transaction.h:149
RecursiveDynamicUsage
static size_t RecursiveDynamicUsage(const CScript &script)
Definition: core_memusage.h:12
CTxOut
An output of a transaction.
Definition: transaction.h:128
FUZZ_TARGET
FUZZ_TARGET(tx_out)
Definition: tx_out.cpp:13
CDataStream::SetVersion
void SetVersion(int n)
Definition: streams.h:362
core_memusage.h
fuzz.h
CTxOut::ToString
std::string ToString() const
Definition: transaction.cpp:54
IsDust
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
Definition: policy.cpp:48
CDataStream
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:204
SER_NETWORK
@ SER_NETWORK
Definition: serialize.h:138
DUST_RELAY_TX_FEE
static const unsigned int DUST_RELAY_TX_FEE
Min feerate for defining dust.
Definition: policy.h:54
GetDustThreshold
CAmount GetDustThreshold(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
Definition: policy.cpp:14
CTxOut::SetNull
void SetNull()
Definition: transaction.h:143
INIT_PROTO_VERSION
static const int INIT_PROTO_VERSION
initial proto version, to be increased after version/verack negotiation
Definition: version.h:15