From 0187d4c118ab4c0f5c2d4fb180c2a8dea8ac53cf Mon Sep 17 00:00:00 2001 From: John Newbery Date: Sun, 10 May 2020 22:28:21 -0400 Subject: [indexes] Add compact block filter headers cache Cache block filter headers at heights of multiples of 1000 in memory. Block filter headers at height 1000x are checkpointed, and will be the most frequently requested. Cache them in memory to avoid costly disk reads. --- src/net_processing.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/net_processing.cpp') diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 1df1fab59..61a254db7 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -129,8 +129,6 @@ static constexpr unsigned int INVENTORY_BROADCAST_MAX = 7 * INVENTORY_BROADCAST_ static constexpr unsigned int AVG_FEEFILTER_BROADCAST_INTERVAL = 10 * 60; /** Maximum feefilter broadcast delay after significant change. */ static constexpr unsigned int MAX_FEEFILTER_CHANGE_DELAY = 5 * 60; -/** Interval between compact filter checkpoints. See BIP 157. */ -static constexpr int CFCHECKPT_INTERVAL = 1000; struct COrphanTx { // When modifying, adapt the copy of this definition in tests/DoS_tests. @@ -1990,7 +1988,7 @@ static bool PrepareBlockFilterRequest(CNode* pfrom, const CChainParams& chain_pa BlockFilterType filter_type, const uint256& stop_hash, const CBlockIndex*& stop_index, - const BlockFilterIndex*& filter_index) + BlockFilterIndex*& filter_index) { const bool supported_filter_type = (filter_type == BlockFilterType::BASIC && @@ -2045,7 +2043,7 @@ static void ProcessGetCFCheckPt(CNode* pfrom, CDataStream& vRecv, const CChainPa const BlockFilterType filter_type = static_cast(filter_type_ser); const CBlockIndex* stop_index; - const BlockFilterIndex* filter_index; + BlockFilterIndex* filter_index; if (!PrepareBlockFilterRequest(pfrom, chain_params, filter_type, stop_hash, stop_index, filter_index)) { return; -- cgit v1.2.3