mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 08:13:52 +02:00
Merge bitcoin/bitcoin#28912: refactor: VectorWriter and SpanReader without nVersion
fae76a1f2ascripted-diff: Use DataStream in most places (MarcoFalke)fac39b56b7refactor: SpanReader without nVersion (MarcoFalke) Pull request description: The serialize version is unused, so remove it. This also allows to remove `GCS_SER_VERSION` and allows a scripted-diff to remove most of `CDataStream`. ACKs for top commit: ajtowns: ACKfae76a1f2aryanofsky: Code review ACKfae76a1f2aTree-SHA512: 3b487dba8ea380f1eacff9fdfb9197f025dbc30906813d3f4c3e6f1e9e4d9f2a169c6f163f51d135e18af538be78e2d2b13d694073ad25c5762980ae971a4c83
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