mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +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:
@@ -16,9 +16,6 @@
|
||||
#include <util/golombrice.h>
|
||||
#include <util/string.h>
|
||||
|
||||
/// Protocol version used to serialize parameters in GCS filter encoding.
|
||||
static constexpr int GCS_SER_VERSION = 0;
|
||||
|
||||
static const std::map<BlockFilterType, std::string> g_filter_types = {
|
||||
{BlockFilterType::BASIC, "basic"},
|
||||
};
|
||||
@@ -49,7 +46,7 @@ GCSFilter::GCSFilter(const Params& params)
|
||||
GCSFilter::GCSFilter(const Params& params, std::vector<unsigned char> encoded_filter, bool skip_decode_check)
|
||||
: m_params(params), m_encoded(std::move(encoded_filter))
|
||||
{
|
||||
SpanReader stream{GCS_SER_VERSION, m_encoded};
|
||||
SpanReader stream{m_encoded};
|
||||
|
||||
uint64_t N = ReadCompactSize(stream);
|
||||
m_N = static_cast<uint32_t>(N);
|
||||
@@ -62,7 +59,7 @@ GCSFilter::GCSFilter(const Params& params, std::vector<unsigned char> encoded_fi
|
||||
|
||||
// Verify that the encoded filter contains exactly N elements. If it has too much or too little
|
||||
// data, a std::ios_base::failure exception will be raised.
|
||||
BitStreamReader<SpanReader> bitreader{stream};
|
||||
BitStreamReader bitreader{stream};
|
||||
for (uint64_t i = 0; i < m_N; ++i) {
|
||||
GolombRiceDecode(bitreader, m_params.m_P);
|
||||
}
|
||||
@@ -103,13 +100,13 @@ GCSFilter::GCSFilter(const Params& params, const ElementSet& elements)
|
||||
|
||||
bool GCSFilter::MatchInternal(const uint64_t* element_hashes, size_t size) const
|
||||
{
|
||||
SpanReader stream{GCS_SER_VERSION, m_encoded};
|
||||
SpanReader stream{m_encoded};
|
||||
|
||||
// Seek forward by size of N
|
||||
uint64_t N = ReadCompactSize(stream);
|
||||
assert(N == m_N);
|
||||
|
||||
BitStreamReader<SpanReader> bitreader{stream};
|
||||
BitStreamReader bitreader{stream};
|
||||
|
||||
uint64_t value = 0;
|
||||
size_t hashes_index = 0;
|
||||
|
||||
Reference in New Issue
Block a user