Rename BlockFilterType::BASIC to BASIC_FILTER

bls dependency defines a macro BASIC as 1 in relic_conf.h.
This caused blockfilter.h to not compile after macro expansion when it says BASIC = 0.

Maybe there is a fancy C++ way to solve this, but renaming it seemed good to me :)

Signed-off-by: Pasta <pasta@dashboost.org>
This commit is contained in:
Pasta 2020-04-16 01:01:12 -05:00 committed by pasta
parent 27a43511f6
commit 223dfc94dc
3 changed files with 5 additions and 5 deletions

View File

@ -227,7 +227,7 @@ BlockFilter::BlockFilter(BlockFilterType filter_type, const CBlock& block, const
: m_filter_type(filter_type), m_block_hash(block.GetHash()) : m_filter_type(filter_type), m_block_hash(block.GetHash())
{ {
switch (m_filter_type) { switch (m_filter_type) {
case BlockFilterType::BASIC: case BlockFilterType::BASIC_FILTER:
m_filter = GCSFilter(m_block_hash.GetUint64(0), m_block_hash.GetUint64(1), m_filter = GCSFilter(m_block_hash.GetUint64(0), m_block_hash.GetUint64(1),
BASIC_FILTER_P, BASIC_FILTER_M, BASIC_FILTER_P, BASIC_FILTER_M,
BasicFilterElements(block, block_undo)); BasicFilterElements(block, block_undo));

View File

@ -78,7 +78,7 @@ constexpr uint32_t BASIC_FILTER_M = 784931;
enum BlockFilterType : uint8_t enum BlockFilterType : uint8_t
{ {
BASIC = 0, BASIC_FILTER = 0,
}; };
/** /**
@ -131,7 +131,7 @@ public:
m_filter_type = static_cast<BlockFilterType>(filter_type); m_filter_type = static_cast<BlockFilterType>(filter_type);
switch (m_filter_type) { switch (m_filter_type) {
case BlockFilterType::BASIC: case BlockFilterType::BASIC_FILTER:
m_filter = GCSFilter(m_block_hash.GetUint64(0), m_block_hash.GetUint64(1), m_filter = GCSFilter(m_block_hash.GetUint64(0), m_block_hash.GetUint64(1),
BASIC_FILTER_P, BASIC_FILTER_M, std::move(encoded_filter)); BASIC_FILTER_P, BASIC_FILTER_M, std::move(encoded_filter));
break; break;

View File

@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(blockfilter_basic_test)
block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(400, included_scripts[3]), 1000, true); block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(400, included_scripts[3]), 1000, true);
block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(500, included_scripts[4]), 10000, false); block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(500, included_scripts[4]), 10000, false);
BlockFilter block_filter(BlockFilterType::BASIC, block, block_undo); BlockFilter block_filter(BlockFilterType::BASIC_FILTER, block, block_undo);
const GCSFilter& filter = block_filter.GetFilter(); const GCSFilter& filter = block_filter.GetFilter();
for (const CScript& script : included_scripts) { for (const CScript& script : included_scripts) {
@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(blockfilters_json_test)
std::vector<unsigned char> filter_basic = ParseHex(test[pos++].get_str()); std::vector<unsigned char> filter_basic = ParseHex(test[pos++].get_str());
uint256 filter_header_basic = ParseHashStr(test[pos++].get_str(), "filter_header_basic"); uint256 filter_header_basic = ParseHashStr(test[pos++].get_str(), "filter_header_basic");
BlockFilter computed_filter_basic(BlockFilterType::BASIC, block, block_undo); BlockFilter computed_filter_basic(BlockFilterType::BASIC_FILTER, block, block_undo);
BOOST_CHECK(computed_filter_basic.GetFilter().GetEncoded() == filter_basic); BOOST_CHECK(computed_filter_basic.GetFilter().GetEncoded() == filter_basic);
uint256 computed_header_basic = computed_filter_basic.ComputeHeader(prev_filter_header_basic); uint256 computed_header_basic = computed_filter_basic.ComputeHeader(prev_filter_header_basic);