Page MenuHomePhabricator

D8322.diff
No OneTemporary

D8322.diff

diff --git a/src/blockfilter.h b/src/blockfilter.h
--- a/src/blockfilter.h
+++ b/src/blockfilter.h
@@ -13,6 +13,7 @@
#include <util/bytevectorhash.h>
#include <cstdint>
+#include <set>
#include <string>
#include <unordered_set>
#include <vector>
@@ -98,7 +99,7 @@
BlockFilterType &filter_type);
/** Get a list of known filter types. */
-const std::vector<BlockFilterType> &AllBlockFilterTypes();
+const std::set<BlockFilterType> &AllBlockFilterTypes();
/** Get a comma-separated list of known filter type names. */
const std::string &ListBlockFilterTypes();
diff --git a/src/blockfilter.cpp b/src/blockfilter.cpp
--- a/src/blockfilter.cpp
+++ b/src/blockfilter.cpp
@@ -219,14 +219,13 @@
return false;
}
-const std::vector<BlockFilterType> &AllBlockFilterTypes() {
- static std::vector<BlockFilterType> types;
+const std::set<BlockFilterType> &AllBlockFilterTypes() {
+ static std::set<BlockFilterType> types;
static std::once_flag flag;
std::call_once(flag, []() {
- types.reserve(g_filter_types.size());
for (auto entry : g_filter_types) {
- types.push_back(entry.first);
+ types.insert(entry.first);
}
});
diff --git a/src/init.cpp b/src/init.cpp
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -82,6 +82,7 @@
#endif
#include <cstdint>
#include <cstdio>
+#include <set>
static const bool DEFAULT_PROXYRANDOMIZE = true;
static const bool DEFAULT_REST_ENABLE = false;
@@ -1572,7 +1573,7 @@
int nFD;
ServiceFlags nLocalServices = ServiceFlags(NODE_NETWORK | NODE_NETWORK_LIMITED);
int64_t peer_connect_timeout;
-std::vector<BlockFilterType> g_enabled_filter_types;
+std::set<BlockFilterType> g_enabled_filter_types;
} // namespace
@@ -1667,14 +1668,13 @@
} else if (blockfilterindex_value != "0") {
const std::vector<std::string> names =
gArgs.GetArgs("-blockfilterindex");
- g_enabled_filter_types.reserve(names.size());
for (const auto &name : names) {
BlockFilterType filter_type;
if (!BlockFilterTypeByName(name, filter_type)) {
return InitError(
strprintf(_("Unknown -blockfilterindex value %s."), name));
}
- g_enabled_filter_types.push_back(filter_type);
+ g_enabled_filter_types.insert(filter_type);
}
}

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 1, 11:06 (19 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187501
Default Alt Text
D8322.diff (2 KB)

Event Timeline