Skip to content

Commit

Permalink
const all the things.
Browse files Browse the repository at this point in the history
Github-Pull: bitcoin#16442
Rebased-From: 3007ee6
  • Loading branch information
jimpo authored and luke-jr committed Mar 5, 2020
1 parent 498546f commit 482126f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -968,9 +968,9 @@ bool AppInitParameterInteraction()

// Signal NODE_COMPACT_FILTERS if peercfilters and required index are both enabled.
if (gArgs.GetBoolArg("-peercfilters", DEFAULT_PEERCFILTERS)) {
bool index_enabled = std::find(g_enabled_filter_types.begin(),
g_enabled_filter_types.end(),
BlockFilterType::BASIC) != g_enabled_filter_types.end();
const bool index_enabled = std::find(g_enabled_filter_types.begin(),
g_enabled_filter_types.end(),
BlockFilterType::BASIC) != g_enabled_filter_types.end();
if (!index_enabled) {
return InitError(_("Cannot set -peercfilters without -blockfilterindex.").translated);
}
Expand Down
13 changes: 7 additions & 6 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ static bool UpdateCFHeadersCache(const BlockFilterIndex& filter_index)
for (uint32_t height = (new_size + 1) * CFCHECKPT_INTERVAL;
height <= static_cast<uint32_t>(active_chain.Height());
height += CFCHECKPT_INTERVAL) {
const CBlockIndex* block_index = active_chain[height];
const CBlockIndex* const block_index = active_chain[height];
uint256 filter_header;

if (!filter_index.LookupFilterHeader(block_index, filter_header)) {
Expand Down Expand Up @@ -1923,7 +1923,7 @@ static bool PrepareBlockFilterRequest(CNode* pfrom, const CChainParams& chain_pa
const CBlockIndex*& stop_index,
BlockFilterIndex*& filter_index)
{
bool supported_filter_type =
const bool supported_filter_type =
(filter_type == BlockFilterType::BASIC &&
(pfrom->GetLocalServices() & NODE_COMPACT_FILTERS));
if (!supported_filter_type) {
Expand Down Expand Up @@ -1981,7 +1981,7 @@ static bool ProcessGetCFilters(CNode* pfrom, CDataStream& vRecv, const CChainPar

vRecv >> filter_type_ser >> start_height >> stop_hash;

BlockFilterType filter_type = static_cast<BlockFilterType>(filter_type_ser);
const BlockFilterType filter_type = static_cast<BlockFilterType>(filter_type_ser);

const CBlockIndex* stop_index;
BlockFilterIndex* filter_index;
Expand Down Expand Up @@ -2016,7 +2016,7 @@ static bool ProcessGetCFHeaders(CNode* pfrom, CDataStream& vRecv, const CChainPa

vRecv >> filter_type_ser >> start_height >> stop_hash;

BlockFilterType filter_type = static_cast<BlockFilterType>(filter_type_ser);
const BlockFilterType filter_type = static_cast<BlockFilterType>(filter_type_ser);

const CBlockIndex* stop_index;
BlockFilterIndex* filter_index;
Expand All @@ -2028,7 +2028,8 @@ static bool ProcessGetCFHeaders(CNode* pfrom, CDataStream& vRecv, const CChainPa

uint256 prev_header;
if (start_height > 0) {
const CBlockIndex* prev_block = stop_index->GetAncestor(start_height - 1);
const CBlockIndex* const prev_block =
stop_index->GetAncestor(static_cast<int>(start_height - 1));
if (!filter_index->LookupFilterHeader(prev_block, prev_header)) {
return error("Failed to find block filter header in index: filter_type=%s, block_hash=%s",
BlockFilterTypeName(filter_type), prev_block->GetBlockHash().ToString());
Expand Down Expand Up @@ -2060,7 +2061,7 @@ static bool ProcessGetCFCheckPt(CNode* pfrom, CDataStream& vRecv, const CChainPa

vRecv >> filter_type_ser >> stop_hash;

BlockFilterType filter_type = static_cast<BlockFilterType>(filter_type_ser);
const BlockFilterType filter_type = static_cast<BlockFilterType>(filter_type_ser);

const CBlockIndex* stop_index;
BlockFilterIndex* filter_index;
Expand Down

0 comments on commit 482126f

Please sign in to comment.