aboutsummaryrefslogtreecommitdiff
path: root/src/index/blockfilterindex.cpp
diff options
context:
space:
mode:
authorRyan Ofsky <ryan@ofsky.org>2022-01-13 07:57:54 -0500
committerRyan Ofsky <ryan@ofsky.org>2022-07-18 13:39:55 -0500
commit33b4d48cfcdf145f49cb2283ac3e2936a4e23fff (patch)
tree482ca2545df1e67a06a7d027cc2275f89ae0cb75 /src/index/blockfilterindex.cpp
parenta0b5b4ae5a24536d333cbce2ea584f2d935c651f (diff)
downloadbitcoin-33b4d48cfcdf145f49cb2283ac3e2936a4e23fff.tar.xz
indexes, refactor: Pass Chain interface instead of CChainState class to indexes
Passing abstract Chain interface will let indexes run in separate processes. This commit does not change behavior in any way.
Diffstat (limited to 'src/index/blockfilterindex.cpp')
-rw-r--r--src/index/blockfilterindex.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/index/blockfilterindex.cpp b/src/index/blockfilterindex.cpp
index e7fad8eb64..15a7cfeaea 100644
--- a/src/index/blockfilterindex.cpp
+++ b/src/index/blockfilterindex.cpp
@@ -94,9 +94,9 @@ struct DBHashKey {
static std::map<BlockFilterType, BlockFilterIndex> g_filter_indexes;
-BlockFilterIndex::BlockFilterIndex(BlockFilterType filter_type,
+BlockFilterIndex::BlockFilterIndex(std::unique_ptr<interfaces::Chain> chain, BlockFilterType filter_type,
size_t n_cache_size, bool f_memory, bool f_wipe)
- : m_filter_type(filter_type)
+ : BaseIndex(std::move(chain)), m_filter_type(filter_type)
{
const std::string& filter_name = BlockFilterTypeName(filter_type);
if (filter_name.empty()) throw std::invalid_argument("unknown filter_type");
@@ -467,12 +467,12 @@ void ForEachBlockFilterIndex(std::function<void (BlockFilterIndex&)> fn)
for (auto& entry : g_filter_indexes) fn(entry.second);
}
-bool InitBlockFilterIndex(BlockFilterType filter_type,
+bool InitBlockFilterIndex(std::function<std::unique_ptr<interfaces::Chain>()> make_chain, BlockFilterType filter_type,
size_t n_cache_size, bool f_memory, bool f_wipe)
{
auto result = g_filter_indexes.emplace(std::piecewise_construct,
std::forward_as_tuple(filter_type),
- std::forward_as_tuple(filter_type,
+ std::forward_as_tuple(make_chain(), filter_type,
n_cache_size, f_memory, f_wipe));
return result.second;
}