mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
refactor: SpanReader without nVersion
The field is unused, so remove it. This is also required for future commits.
This commit is contained in:
@@ -68,8 +68,8 @@ FUZZ_TARGET(golomb_rice)
|
||||
|
||||
std::vector<uint64_t> decoded_deltas;
|
||||
{
|
||||
SpanReader stream{0, golomb_rice_data};
|
||||
BitStreamReader<SpanReader> bitreader{stream};
|
||||
SpanReader stream{golomb_rice_data};
|
||||
BitStreamReader bitreader{stream};
|
||||
const uint32_t n = static_cast<uint32_t>(ReadCompactSize(stream));
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
decoded_deltas.push_back(GolombRiceDecode(bitreader, BASIC_FILTER_P));
|
||||
@@ -80,14 +80,14 @@ FUZZ_TARGET(golomb_rice)
|
||||
|
||||
{
|
||||
const std::vector<uint8_t> random_bytes = ConsumeRandomLengthByteVector(fuzzed_data_provider, 1024);
|
||||
SpanReader stream{0, random_bytes};
|
||||
SpanReader stream{random_bytes};
|
||||
uint32_t n;
|
||||
try {
|
||||
n = static_cast<uint32_t>(ReadCompactSize(stream));
|
||||
} catch (const std::ios_base::failure&) {
|
||||
return;
|
||||
}
|
||||
BitStreamReader<SpanReader> bitreader{stream};
|
||||
BitStreamReader bitreader{stream};
|
||||
for (uint32_t i = 0; i < std::min<uint32_t>(n, 1024); ++i) {
|
||||
try {
|
||||
(void)GolombRiceDecode(bitreader, BASIC_FILTER_P);
|
||||
|
||||
@@ -54,7 +54,7 @@ CMutableTransaction TxFromHex(const std::string& str)
|
||||
{
|
||||
CMutableTransaction tx;
|
||||
try {
|
||||
SpanReader{0, CheckedParseHex(str)} >> TX_NO_WITNESS(tx);
|
||||
SpanReader{CheckedParseHex(str)} >> TX_NO_WITNESS(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{0, CheckedParseHex(univalue[i].get_str())} >> txout;
|
||||
SpanReader{CheckedParseHex(univalue[i].get_str())} >> txout;
|
||||
} catch (const std::ios_base::failure&) {
|
||||
throw std::runtime_error("Prevout invalid format");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user