@@ -47,7 +47,7 @@ GCSFilter::GCSFilter(const Params& params)
4747 : m_params(params), m_N(0 ), m_F(0 ), m_encoded{0 }
4848{}
4949
50- GCSFilter::GCSFilter (const Params& params, std::vector<unsigned char > encoded_filter, bool filter_checked )
50+ GCSFilter::GCSFilter (const Params& params, std::vector<unsigned char > encoded_filter)
5151 : m_params(params), m_encoded(std::move(encoded_filter))
5252{
5353 SpanReader stream{GCS_SER_TYPE, GCS_SER_VERSION, m_encoded};
@@ -58,18 +58,6 @@ GCSFilter::GCSFilter(const Params& params, std::vector<unsigned char> encoded_fi
5858 throw std::ios_base::failure (" N must be <2^32" );
5959 }
6060 m_F = static_cast <uint64_t >(m_N) * static_cast <uint64_t >(m_params.m_M );
61-
62- if (filter_checked) return ;
63-
64- // Verify that the encoded filter contains exactly N elements. If it has too much or too little
65- // data, a std::ios_base::failure exception will be raised.
66- BitStreamReader<SpanReader> bitreader{stream};
67- for (uint64_t i = 0 ; i < m_N; ++i) {
68- GolombRiceDecode (bitreader, m_params.m_P );
69- }
70- if (!stream.empty ()) {
71- throw std::ios_base::failure (" encoded_filter contains excess data" );
72- }
7361}
7462
7563GCSFilter::GCSFilter (const Params& params, const ElementSet& elements)
@@ -221,14 +209,14 @@ static GCSFilter::ElementSet BasicFilterElements(const CBlock& block,
221209}
222210
223211BlockFilter::BlockFilter (BlockFilterType filter_type, const uint256& block_hash,
224- std::vector<unsigned char > filter, bool filter_checked )
212+ std::vector<unsigned char > filter)
225213 : m_filter_type(filter_type), m_block_hash(block_hash)
226214{
227215 GCSFilter::Params params;
228216 if (!BuildParams (params)) {
229217 throw std::invalid_argument (" unknown filter_type" );
230218 }
231- m_filter = GCSFilter (params, std::move (filter), filter_checked );
219+ m_filter = GCSFilter (params, std::move (filter));
232220}
233221
234222BlockFilter::BlockFilter (BlockFilterType filter_type, const CBlock& block, const CBlockUndo& block_undo)
0 commit comments