mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-03 02:06:18 +00:00
This refactor does not change behavior. However, it avoids a vector copy, which can lead to a minimal speed-up of 1%-5%, depending on the call-site. This is mostly relevant for the fuzz tests and utils that read large blobs of data (like a full block).
32 lines
857 B
C++
32 lines
857 B
C++
// Copyright (c) 2019-present The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include <consensus/validation.h>
|
|
#include <core_memusage.h>
|
|
#include <policy/feerate.h>
|
|
#include <policy/policy.h>
|
|
#include <primitives/transaction.h>
|
|
#include <streams.h>
|
|
#include <test/fuzz/fuzz.h>
|
|
|
|
FUZZ_TARGET(tx_out)
|
|
{
|
|
CTxOut tx_out;
|
|
try {
|
|
SpanReader{buffer} >> tx_out;
|
|
} catch (const std::ios_base::failure&) {
|
|
return;
|
|
}
|
|
|
|
const CFeeRate dust_relay_fee{DUST_RELAY_TX_FEE};
|
|
(void)GetDustThreshold(tx_out, dust_relay_fee);
|
|
(void)IsDust(tx_out, dust_relay_fee);
|
|
(void)RecursiveDynamicUsage(tx_out);
|
|
|
|
(void)tx_out.ToString();
|
|
(void)tx_out.IsNull();
|
|
tx_out.SetNull();
|
|
assert(tx_out.IsNull());
|
|
}
|