Skip to content

Commit

Permalink
Rename BlockFilterType::BASIC to BASIC_FILTER
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
PastaPastaPasta committed Apr 16, 2020
1 parent 223c990 commit b421489
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/blockfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ BlockFilter::BlockFilter(BlockFilterType filter_type, const CBlock& block, const
: m_filter_type(filter_type), m_block_hash(block.GetHash())
{
switch (m_filter_type) {
case BlockFilterType::BASIC:
case BlockFilterType::BASIC_FILTER:
m_filter = GCSFilter(m_block_hash.GetUint64(0), m_block_hash.GetUint64(1),
BASIC_FILTER_P, BASIC_FILTER_M,
BasicFilterElements(block, block_undo));
Expand Down
4 changes: 2 additions & 2 deletions src/blockfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ constexpr uint32_t BASIC_FILTER_M = 784931;

enum BlockFilterType : uint8_t
{
BASIC = 0,
BASIC_FILTER = 0,
};

/**
Expand Down Expand Up @@ -131,7 +131,7 @@ class BlockFilter
m_filter_type = static_cast<BlockFilterType>(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),
BASIC_FILTER_P, BASIC_FILTER_M, std::move(encoded_filter));
break;
Expand Down
4 changes: 2 additions & 2 deletions src/test/blockfilter_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(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();

for (const CScript& script : included_scripts) {
Expand Down Expand Up @@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(blockfilters_json_test)
std::vector<unsigned char> filter_basic = ParseHex(test[pos++].get_str());
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);

uint256 computed_header_basic = computed_filter_basic.ComputeHeader(prev_filter_header_basic);
Expand Down

0 comments on commit b421489

Please sign in to comment.