diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-09-11 14:58:22 +0000 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-09-19 14:19:57 +0000 |
commit | fa4a9c0f4334678fb80358ead667807bf2a0a153 (patch) | |
tree | 027945491283d0c943ca2f704c8f499253311a32 /src/test | |
parent | f01416e23c9c820517c37003a2a98dd46d1022ba (diff) |
Remove unused GetType() from OverrideStream, CVectorWriter, SpanReader
GetType() is never called, so it is completely unused and can be
removed.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/fuzz/golomb_rice.cpp | 6 | ||||
-rw-r--r-- | src/test/fuzz/script_assets_test_minimizer.cpp | 4 | ||||
-rw-r--r-- | src/test/script_tests.cpp | 6 | ||||
-rw-r--r-- | src/test/streams_tests.cpp | 34 |
4 files changed, 25 insertions, 25 deletions
diff --git a/src/test/fuzz/golomb_rice.cpp b/src/test/fuzz/golomb_rice.cpp index e006653ca9..f3073c5c97 100644 --- a/src/test/fuzz/golomb_rice.cpp +++ b/src/test/fuzz/golomb_rice.cpp @@ -51,7 +51,7 @@ FUZZ_TARGET(golomb_rice) for (int i = 0; i < n; ++i) { elements.insert(ConsumeRandomLengthByteVector(fuzzed_data_provider, 16)); } - CVectorWriter stream(SER_NETWORK, 0, golomb_rice_data, 0); + CVectorWriter stream{0, golomb_rice_data, 0}; WriteCompactSize(stream, static_cast<uint32_t>(elements.size())); BitStreamWriter<CVectorWriter> bitwriter(stream); if (!elements.empty()) { @@ -68,7 +68,7 @@ FUZZ_TARGET(golomb_rice) std::vector<uint64_t> decoded_deltas; { - SpanReader stream{SER_NETWORK, 0, golomb_rice_data}; + SpanReader stream{0, golomb_rice_data}; BitStreamReader<SpanReader> bitreader{stream}; const uint32_t n = static_cast<uint32_t>(ReadCompactSize(stream)); for (uint32_t i = 0; i < n; ++i) { @@ -80,7 +80,7 @@ FUZZ_TARGET(golomb_rice) { const std::vector<uint8_t> random_bytes = ConsumeRandomLengthByteVector(fuzzed_data_provider, 1024); - SpanReader stream{SER_NETWORK, 0, random_bytes}; + SpanReader stream{0, random_bytes}; uint32_t n; try { n = static_cast<uint32_t>(ReadCompactSize(stream)); diff --git a/src/test/fuzz/script_assets_test_minimizer.cpp b/src/test/fuzz/script_assets_test_minimizer.cpp index 7862be2f21..66c862a6f9 100644 --- a/src/test/fuzz/script_assets_test_minimizer.cpp +++ b/src/test/fuzz/script_assets_test_minimizer.cpp @@ -54,7 +54,7 @@ CMutableTransaction TxFromHex(const std::string& str) { CMutableTransaction tx; try { - SpanReader{SER_DISK, SERIALIZE_TRANSACTION_NO_WITNESS, CheckedParseHex(str)} >> tx; + SpanReader{SERIALIZE_TRANSACTION_NO_WITNESS, CheckedParseHex(str)} >> tx; } catch (const std::ios_base::failure&) { throw std::runtime_error("Tx deserialization failure"); } @@ -68,7 +68,7 @@ std::vector<CTxOut> TxOutsFromJSON(const UniValue& univalue) for (size_t i = 0; i < univalue.size(); ++i) { CTxOut txout; try { - SpanReader{SER_DISK, 0, CheckedParseHex(univalue[i].get_str())} >> txout; + SpanReader{0, CheckedParseHex(univalue[i].get_str())} >> txout; } catch (const std::ios_base::failure&) { throw std::runtime_error("Prevout invalid format"); } diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp index d63bfb9603..94656b229e 100644 --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -1470,7 +1470,7 @@ BOOST_AUTO_TEST_CASE(script_HasValidOps) static CMutableTransaction TxFromHex(const std::string& str) { CMutableTransaction tx; - SpanReader{SER_DISK, SERIALIZE_TRANSACTION_NO_WITNESS, ParseHex(str)} >> tx; + SpanReader{SERIALIZE_TRANSACTION_NO_WITNESS, ParseHex(str)} >> tx; return tx; } @@ -1480,7 +1480,7 @@ static std::vector<CTxOut> TxOutsFromJSON(const UniValue& univalue) std::vector<CTxOut> prevouts; for (size_t i = 0; i < univalue.size(); ++i) { CTxOut txout; - SpanReader{SER_DISK, 0, ParseHex(univalue[i].get_str())} >> txout; + SpanReader{0, ParseHex(univalue[i].get_str())} >> txout; prevouts.push_back(std::move(txout)); } return prevouts; @@ -1751,7 +1751,7 @@ BOOST_AUTO_TEST_CASE(bip341_keypath_test_vectors) for (const auto& vec : vectors.getValues()) { auto txhex = ParseHex(vec["given"]["rawUnsignedTx"].get_str()); CMutableTransaction tx; - SpanReader{SER_NETWORK, PROTOCOL_VERSION, txhex} >> tx; + SpanReader{PROTOCOL_VERSION, txhex} >> tx; std::vector<CTxOut> utxos; for (const auto& utxo_spent : vec["given"]["utxosSpent"].getValues()) { auto script_bytes = ParseHex(utxo_spent["scriptPubKey"].get_str()); diff --git a/src/test/streams_tests.cpp b/src/test/streams_tests.cpp index 99740ee779..aca38c747f 100644 --- a/src/test/streams_tests.cpp +++ b/src/test/streams_tests.cpp @@ -74,49 +74,49 @@ BOOST_AUTO_TEST_CASE(streams_vector_writer) // point should yield the same results, even if the first test grew the // vector. - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 0, a, b); + CVectorWriter{INIT_PROTO_VERSION, vch, 0, a, b}; BOOST_CHECK((vch == std::vector<unsigned char>{{1, 2}})); - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 0, a, b); + CVectorWriter{INIT_PROTO_VERSION, vch, 0, a, b}; BOOST_CHECK((vch == std::vector<unsigned char>{{1, 2}})); vch.clear(); - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 2, a, b); + CVectorWriter{INIT_PROTO_VERSION, vch, 2, a, b}; BOOST_CHECK((vch == std::vector<unsigned char>{{0, 0, 1, 2}})); - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 2, a, b); + CVectorWriter{INIT_PROTO_VERSION, vch, 2, a, b}; BOOST_CHECK((vch == std::vector<unsigned char>{{0, 0, 1, 2}})); vch.clear(); vch.resize(5, 0); - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 2, a, b); + CVectorWriter{INIT_PROTO_VERSION, vch, 2, a, b}; BOOST_CHECK((vch == std::vector<unsigned char>{{0, 0, 1, 2, 0}})); - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 2, a, b); + CVectorWriter{INIT_PROTO_VERSION, vch, 2, a, b}; BOOST_CHECK((vch == std::vector<unsigned char>{{0, 0, 1, 2, 0}})); vch.clear(); vch.resize(4, 0); - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 3, a, b); + CVectorWriter{INIT_PROTO_VERSION, vch, 3, a, b}; BOOST_CHECK((vch == std::vector<unsigned char>{{0, 0, 0, 1, 2}})); - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 3, a, b); + CVectorWriter{INIT_PROTO_VERSION, vch, 3, a, b}; BOOST_CHECK((vch == std::vector<unsigned char>{{0, 0, 0, 1, 2}})); vch.clear(); vch.resize(4, 0); - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 4, a, b); + CVectorWriter{INIT_PROTO_VERSION, vch, 4, a, b}; BOOST_CHECK((vch == std::vector<unsigned char>{{0, 0, 0, 0, 1, 2}})); - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 4, a, b); + CVectorWriter{INIT_PROTO_VERSION, vch, 4, a, b}; BOOST_CHECK((vch == std::vector<unsigned char>{{0, 0, 0, 0, 1, 2}})); vch.clear(); - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 0, bytes); + CVectorWriter{INIT_PROTO_VERSION, vch, 0, bytes}; BOOST_CHECK((vch == std::vector<unsigned char>{{3, 4, 5, 6}})); - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 0, bytes); + CVectorWriter{INIT_PROTO_VERSION, vch, 0, bytes}; BOOST_CHECK((vch == std::vector<unsigned char>{{3, 4, 5, 6}})); vch.clear(); vch.resize(4, 8); - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 2, a, bytes, b); + CVectorWriter{INIT_PROTO_VERSION, vch, 2, a, bytes, b}; BOOST_CHECK((vch == std::vector<unsigned char>{{8, 8, 1, 3, 4, 5, 6, 2}})); - CVectorWriter(SER_NETWORK, INIT_PROTO_VERSION, vch, 2, a, bytes, b); + CVectorWriter{INIT_PROTO_VERSION, vch, 2, a, bytes, b}; BOOST_CHECK((vch == std::vector<unsigned char>{{8, 8, 1, 3, 4, 5, 6, 2}})); vch.clear(); } @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(streams_vector_reader) { std::vector<unsigned char> vch = {1, 255, 3, 4, 5, 6}; - SpanReader reader{SER_NETWORK, INIT_PROTO_VERSION, vch}; + SpanReader reader{INIT_PROTO_VERSION, vch}; BOOST_CHECK_EQUAL(reader.size(), 6U); BOOST_CHECK(!reader.empty()); @@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE(streams_vector_reader) BOOST_CHECK_THROW(reader >> d, std::ios_base::failure); // Read a 4 bytes as a signed int from the beginning of the buffer. - SpanReader new_reader{SER_NETWORK, INIT_PROTO_VERSION, vch}; + SpanReader new_reader{INIT_PROTO_VERSION, vch}; new_reader >> d; BOOST_CHECK_EQUAL(d, 67370753); // 1,255,3,4 in little-endian base-256 BOOST_CHECK_EQUAL(new_reader.size(), 2U); @@ -169,7 +169,7 @@ BOOST_AUTO_TEST_CASE(streams_vector_reader) BOOST_AUTO_TEST_CASE(streams_vector_reader_rvalue) { std::vector<uint8_t> data{0x82, 0xa7, 0x31}; - SpanReader reader{SER_NETWORK, INIT_PROTO_VERSION, data}; + SpanReader reader{INIT_PROTO_VERSION, data}; uint32_t varint = 0; // Deserialize into r-value reader >> VARINT(varint); |