diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-11-28 14:34:26 +0100 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-11-30 11:27:21 +0100 |
commit | fa7eb4f5c3d2438f9689cd46b22dcfd50f6bd751 (patch) | |
tree | 3c6862b2f7ea94e3d6a7412b6a9d244bc3ab6aec /src | |
parent | 7bc8c5312bf51edd3d85e1599b5d6ae32c8fd7b5 (diff) |
fuzz: Drop unused version from fuzz input format
Diffstat (limited to 'src')
-rw-r--r-- | src/test/fuzz/block.cpp | 6 | ||||
-rw-r--r-- | src/test/fuzz/deserialize.cpp | 18 | ||||
-rw-r--r-- | src/test/fuzz/transaction.cpp | 15 |
3 files changed, 7 insertions, 32 deletions
diff --git a/src/test/fuzz/block.cpp b/src/test/fuzz/block.cpp index 09c0ed23d2..e38b871747 100644 --- a/src/test/fuzz/block.cpp +++ b/src/test/fuzz/block.cpp @@ -13,7 +13,6 @@ #include <test/fuzz/fuzz.h> #include <util/chaintype.h> #include <validation.h> -#include <version.h> #include <cassert> #include <string> @@ -25,12 +24,9 @@ void initialize_block() FUZZ_TARGET(block, .init = initialize_block) { - CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION); + DataStream ds{buffer}; CBlock block; try { - int nVersion; - ds >> nVersion; - ds.SetVersion(nVersion); ds >> TX_WITH_WITNESS(block); } catch (const std::ios_base::failure&) { return; diff --git a/src/test/fuzz/deserialize.cpp b/src/test/fuzz/deserialize.cpp index 33c9a93c65..ebc5673e71 100644 --- a/src/test/fuzz/deserialize.cpp +++ b/src/test/fuzz/deserialize.cpp @@ -28,7 +28,6 @@ #include <test/fuzz/util.h> #include <test/util/setup_common.h> #include <undo.h> -#include <version.h> #include <exception> #include <optional> @@ -91,15 +90,15 @@ void DeserializeFromFuzzingInput(FuzzBufferType buffer, T&& obj, const P& params } template <typename T> -CDataStream Serialize(const T& obj) +DataStream Serialize(const T& obj) { - CDataStream ds{SER_NETWORK, INIT_PROTO_VERSION}; + DataStream ds{}; ds << obj; return ds; } template <typename T> -T Deserialize(CDataStream ds) +T Deserialize(DataStream ds) { T obj; ds >> obj; @@ -109,16 +108,7 @@ T Deserialize(CDataStream ds) template <typename T> void DeserializeFromFuzzingInput(FuzzBufferType buffer, T&& obj) { - CDataStream ds{buffer, SER_NETWORK, INIT_PROTO_VERSION}; - { - try { - int version; - ds >> version; - ds.SetVersion(version); - } catch (const std::ios_base::failure&) { - throw invalid_fuzzing_input_exception(); - } - } + DataStream ds{buffer}; try { ds >> obj; } catch (const std::ios_base::failure&) { diff --git a/src/test/fuzz/transaction.cpp b/src/test/fuzz/transaction.cpp index ccaee424fb..2a043f7458 100644 --- a/src/test/fuzz/transaction.cpp +++ b/src/test/fuzz/transaction.cpp @@ -18,7 +18,6 @@ #include <util/chaintype.h> #include <util/rbf.h> #include <validation.h> -#include <version.h> #include <cassert> @@ -29,14 +28,7 @@ void initialize_transaction() FUZZ_TARGET(transaction, .init = initialize_transaction) { - CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION); - try { - int nVersion; - ds >> nVersion; - ds.SetVersion(nVersion); - } catch (const std::ios_base::failure&) { - return; - } + DataStream ds{buffer}; bool valid_tx = true; const CTransaction tx = [&] { try { @@ -47,12 +39,9 @@ FUZZ_TARGET(transaction, .init = initialize_transaction) } }(); bool valid_mutable_tx = true; - CDataStream ds_mtx(buffer, SER_NETWORK, INIT_PROTO_VERSION); + DataStream ds_mtx{buffer}; CMutableTransaction mutable_tx; try { - int nVersion; - ds_mtx >> nVersion; - ds_mtx.SetVersion(nVersion); ds_mtx >> TX_WITH_WITNESS(mutable_tx); } catch (const std::ios_base::failure&) { valid_mutable_tx = false; |